functions suddenly connected after restart

2 ビュー (過去 30 日間)
Marc Laub
Marc Laub 2019 年 8 月 11 日
編集済み: dpb 2019 年 8 月 11 日
Hey there,
so i got a little problem. All started when my matlab didnt want to stop some calculations. I pressed ctrl+c like an idiot and pressed quit so many times, somehow it didnt work. in the command window some kind of problems wioth "eval" appeared. So i just shut down matlab and reopened it. From this point on my code didnt work anymore...
-All of my functions seem to be connected. Even if "function" and "end" of the specific function are the right places and if i hover over function it tells me where the correct end is, BUT the wight line on the left that embraces functions or loops, doenst stop at ends, but continues all the way down.
Additionally many varriables or indices are colored (or marked) as if they were global variables, but they are definitly not
I was able to "repair" some of my code. Some functions that were connected could be seperated by marking the whole function and align them with ctrl+i. There were aligned correctly before, so ctrl+i didnt change anything but getting rid of the interconnection white lign embrace.
Unfortunatley this does not work for all function, and im not sure what the generell problem is, that leads to this behaviour
My whole code should be attached below.
Many thanks in adavence if someone can help me with this.
Best regards.


dpb 2019 年 8 月 11 日
編集済み: dpb 2019 年 8 月 11 日
Apparently focus was in the editor and some of your keystrokes CTRL^C got interpreted to paste and some extra end statements were inserted at the end of the main function around line 520ff.
There also was a missing closing bracket and parenthesis on the extremely long ylim() line 342...I wrapped that line and reformatted indenting to be more consistent and closed up quite a lot of white space.
I'd strongly recommend refactoring the function to not have 500+ line function...
BTW, the problem was given in the main error message in the editor as unbalanced END statements.
Both missing or extra END and closing brackets/parentheses confuse the input parser greatly and can interact--particularly the [ ... missing the closing ] tries to just keep on agglomerating stuff...
BTW, I converted one nested if...elseif...end construct on the case_acc variable to a SWITCH block while was checking for where the broken END construct could be...much cleaner. But, while doing that I noticed
case 2
if trig>1.2 || err==1
elseif err==1
in which the elseif block will never get triggered because the if clause is written as or and so if err==1 it's the clause that will be executed irrespective of the value of trig
Dunno if that's of any concern or not, but probably not what was intended, exactly.

その他の回答 (0 件)


Find more on Programming 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!

Translated by