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.
- 类别:
- Editor
评论
要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。