Code Folding is broken, can't see hundreds of lines of code in Editor

72 次查看(过去 30 天)
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.

回答(1 个)

Saurabh
Saurabh 2024-10-24,8:02
移动:the cyclist 2024-10-24,14:32
Hi @Val,
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.

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品


版本

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by