What to do if my script gives error "The input was too complicated or too big for MATLAB to parse"?
조회 수: 5 (최근 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
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!