Matlab is not recognizing sections %%

107 vues (au cours des 30 derniers jours)
Taylor Nichols
Taylor Nichols le 24 Jan 2019
Commenté : Steven Lord le 31 Mar 2024 à 17:24
I am working with Matlab 2018a and for some reason Matlab stop recognizing my sections (%%). Maybe I did something after messing in Home>Preferences, but I'm not really sure. Has anyone had this problem before? I've look online and people say "Enable Cell Mode", but I have no idea how to do this in 2018a.
thanks in advance.
  1 commentaire
Reza Banaei
Reza Banaei le 6 Jan 2022
Look for open sentences in your code. Something like
'output' ...
will break the sectioning.

Connectez-vous pour commenter.

Réponses (3)

Steven Lord
Steven Lord le 18 Juin 2019
Look for the message indicator in your file in the Editor. See the first picture on this documentation page for the location of the message indicator. Is it red? If so your code has a syntax error that would prevent it from running successfully, and if your code is not syntactically valid I believe MATLAB will not recognize your sections. Correct the problems that Code Analyzer has identified as red (error) issues and I expect the sections should resune working.
  4 commentaires
ohad akler
ohad akler le 31 Mar 2024 à 17:10
Federico answer works !
Steven Lord
Steven Lord le 31 Mar 2024 à 17:24
Yes, MATLAB program file names are not allowed to contain spaces. Otherwise, consider the example Federico Sansalone posted. If you had both "Capacity Problem.m" and Capacity.m, would "Capacity Problem" call the first of those functions with no inputs or the second of those functions with the char vector 'Problem' as input?

Connectez-vous pour commenter.


Arvind Sathyanarayanan
Arvind Sathyanarayanan le 24 Jan 2019
Did you turn-off the sections in the Autoformatting menu? MA.png
  2 commentaires
Blake Porter
Blake Porter le 18 Juin 2019
I have the same issue and I have both section break options ticked. Restarted Matlab and computer did not help.
per isakson
per isakson le 7 Jan 2022
Is your "message indicator" green?

Connectez-vous pour commenter.


KIDKAWHI
KIDKAWHI le 17 Nov 2021
welp we all stuck in this boat
  3 commentaires
Marion Kreins
Marion Kreins le 23 Déc 2021
thx, it worked :)
per isakson
per isakson le 23 Déc 2021
Modifié(e) : per isakson le 23 Déc 2021
Spaces in mfile names are not allowed. The "message indicator" of R2018b indicates the error. It's red!
However, in my simple case R2018b still recognizes the sections.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Language Fundamentals dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by