Is there a way to create "sub-folding" / "sub-sections"?
    49 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
Hi,
I know I can create sections in my script editor with 
%%
Question is, can I make several layers of 'sectioning'?
I mean, similar to headings in WORD...
Something like:
%%_1
%%_1.1
%%_1.1.1
that way I could organize, divide & fold my code as I please...
Thank you!
0 commentaires
Réponses (2)
  Darren Woods
 le 7 Juin 2024
        Raising this thread again.
Other IDEs, such as Spyder for python, allow for the use of multiple subsection levels, e.g. %%, %%%, %%%%. These are conveniently indented in the code outline pane and all levels can be expanded and collapsed. Not so in Matlab? This seems like an easy functionality to add.
Cheers,
Darren.
  Prateek Rai
    
 le 8 Oct 2021
        To my understanding, you want to make several layers of sectioning in a MATLAB script.
This is possible when you have loop (such as for loop), conditional statement (such as an if statement) or functions in the script.
You can refer to Create and Run Sections in Code MathWorks documentation page to learn more on the behavior of sections in functions or behavior of sections in loops and conditional statements.
2 commentaires
  Andre Zeug
      
 le 18 Oct 2024
				As workaround I do:
%% Section (1)
...
if 1
    %% Subsection (1.1)
    ...
    %% Subsection (1.2)
    ...
end
%% Section (2)
...
This increases the readability of my code (when using code folding). 
Voir également
Catégories
				En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




