Is there a way to do code folding on part of an if statement?
4 views (last 30 days)
Show older comments
If I try to do code folding on lines 3-5 in the following simple example, then MATLAB automatically folds the entire if statement into a suppressed line.
Is there a way to prevent this, and only fold parts of the if statement at a time?
Thanks.
1 x = 5;
2 if x == 5
3 y = 2;
4 y = 3;
5 y = 4;
6 elseif x == 6
7 y = 3;
8 y = 4;
9 y = 5;
10 end
1 Comment
Bob Thompson
on 8 Oct 2019
Edited: Bob Thompson
on 8 Oct 2019
I suggest looking at the answer in this link. I did see in the preferences of code folding that you can turn on if/else and section folding. Section folding seems to be the best way to implement what you're asking for, after a brief search, because I don't think if/else will allow you to target specific if, elseif, or else sections.
Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!