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:
![](https://blogs.mathworks.com/images/desktop/ken_orr_folding_with_cells/code.png)
and insert cell markers before and after the code you want to fold, like this:
![](https://blogs.mathworks.com/images/desktop/ken_orr_folding_with_cells/code_with_unfolded_cells.png)
Finally, collapse the cell and voila! You’ve folded an arbitrary chunk of code!
![](https://blogs.mathworks.com/images/desktop/ken_orr_folding_with_cells/code_with_folded_cells.png)
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 アカウントにサインインするか新しい MathWorks アカウントを作成します。