What to do if my script gives error "The input was too complicated or too big for MATLAB to parse"?
12 次查看(过去 30 天)
显示 更早的评论
I have too many loops and I think that is the reason for this error. Is there a work around for such error or would I have to write my entire code again?
Thanks & Regards
2 个评论
aborghes
2017-8-9
编辑:aborghes
2017-8-9
The suggested solution to this is to break your code down into multiple functions or files. Another thing you could try would be to use indexing rather than for loops depending on what your use case is. Documentation on indexing can be found here: https://www.mathworks.com/help/matlab/math/matrix-indexing.html
Jan
2017-8-10
I've seen codes with 10'000 lines in a single function and 20'000 characters in a line. There were deeply nested loops and a bunch of nested functions. But I've never seen this error message. I do not think that "too many loops" are the reason of the problem.
Could you post a typical part of the code? I'm curious.
I assume you did not write this code for months and run it today the first time. So what has been changed since it ran successfully?
回答(1 个)
Rik
2024-2-4
I know I'm almost 7 years late to the party, but I just ran into this problem and was able to find a source and solution.
For my 12k line file (with almost 1k lines of minified code (which causes several mlint warnings per line)), the cause was an improperly removed conditional block. The code assembling the file was meant to only include the code in the else-block, but it only removed the end statement.
That caused Matlab to think there was deep nesting of functions. Too deep to trigger the warning about end not being alligned with the matching for/if. Removing blocks of code eventually reduced the number of mlint warnings (and/or the nesting) sufficiently to let this error through.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!