What to do if my script gives error "The input was too complicated or too big for MATLAB to parse"?

조회 수: 10 (최근 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
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
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
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.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by