Code Folding is broken, can't see hundreds of lines of code in Editor
67 views (last 30 days)
Show older comments
Hi everyone, I'm having a serious issue within the MATLAB Editor. I really like writing my code using sections (as defined by %% syntax) and then enabling code folding for sections for readability.
Recently I opened a .mat file I used very regularly a few months ago and found that this code folding is very broken. The plus/minus icons next to the line numbers are not always aligned with the sections or really anything that can be code-folded, at least as far as I can tell. Also, and most critically, I can't unfold enough to see all of my code. The best I can do is display lines 1-232 and lines 783-951, but everything between 232-783 is completely inaccessible. There is a clickable ellipsis at the end of line 232, but clicking it does absolutely nothing (I saw the same clickable ellipsis in other lines, and clicking it would unfold some more code). Also, line 232 is not the end of that section of code.
Thankfully, if I hit "Run" then the whole code runs with no problem. But this is still a huge issue because I can't access 500+ lines of my code to edit them. I have attached a screenshot of my editor (with the code itself greyed out) showing exactly what I mean.
I've had similar code folding issues before but they were fairly easy to resolve by messing with the code folding settings in "Preferences" or just restarting MATLAB. Doing so now doesn't help at all. Any help with this would be immensely appreciated.
0 Comments
Answers (1)
Saurabh
on 24 Oct 2024 at 8:02
Moved: the cyclist
on 24 Oct 2024 at 14:32
I experienced the same issue but could fix it by clicking on the button "Expand All" in the "View" tab of Matlab App Designer.
Or it may be because MATLAB wasn't able to parse the entire .m file. Check out the following link if this is the case:
If this does not solve the issue, consider contacting MathWorks technical support.
I hope this helps.
1 Comment
See Also
Categories
Find more on Introduction to Installation and Licensing 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!