MATLAB Community

MATLAB, community & more

Fold whatever you want using cells

Juliette recently suggested that users should be able to fold whatever code they like. While this is a great feature idea, the MATLAB Editor doesn’t currently support folding arbitrary sections of code. You can, however, simulate the feature using cells.

Start by turing on Cell folding in Preferences -> Editor/Debugger -> Code Folding (folding cells is off by default). Now, take your raw code, which we’ll say looks like this:

and insert cell markers before and after the code you want to fold, like this:

Finally, collapse the cell and voila! You’ve folded an arbitrary chunk of code!

I realize this isn’t the ideal solution for folding a random chunk of code, but it’s a reasonable workaround in the meantime.

  • print


댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.