Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Is there a way to 'fold up' sections of code - like when you close up a for loop

Asked by Tom on 4 Apr 2012

Is there a way to hide sections of code - like when you close up a for loop?

I have quite a long code with a few different sections, and while I'm working on one section I'd like to hide the other sections so the code is a bit more manageable to get around.

1 Comment

Matt Fig on 2 Nov 2012

Tom's question

Is there a way to hide sections of code - like when you close up a for loop?

I have quite a long code with a few different sections, and while I'm working on one section I'd like to hide the other sections so the code is a bit more manageable to get around.

Tom

Tags

Products

No products are associated with this question.

1 Answer

Answer by Daniel on 4 Apr 2012
Accepted answer

Under preferences you can enable code folding for blocks. Blocks are defined in MATLAB as sections starting with %% (I am not sure if they can have anything else on the line).

So you should be able to fold

%%
a=1;
b=2;
%%
x=3;
y=4;

1 Comment

Tom on 5 Apr 2012

thanks!

Daniel

Contact us