Why do I get the error '??? Output argument ‹variable› (and maybe others) not assigned during call to ‹function›.' ?
조회 수: 817 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2012년 2월 27일
편집: MathWorks Support Team
2019년 2월 19일
Why do I get the following error message :
??? Output argument ‹variable› (and maybe others) not assigned during call to ‹function›.
채택된 답변
MathWorks Support Team
2019년 2월 20일
Explanation:
One of the functions you have called is defined to return an output argument but that output argument does not exist in the function when it tries to return.
Common causes:
You have misspelled the name of one of your output arguments inside your function, or you have forgotten to assign a value to one of the output arguments of your function. Alternatively, the function was originally written with one or more output arguments, but the section of the function that computed the output argument was removed or modified in such a way that the output argument is now extraneous.
Solution:
Stop MATLAB on the last line of the function listed in the warning or error message. Verify that each of the output arguments listed in the function declaration line at the beginning of the function exist after that last line is executed (using the DBSTEP function or the Step button in the Editor). If the arguments do not exist, examine the function to determine where you intended the arguments to be declared. Verify that those lines of code are being executed and have no typographical errors.
Example demonstrating this error:
OutputNotAssigned.m
댓글 수: 0
추가 답변 (1개)
Beginner Dave
2018년 2월 11일
I also had the problem. After confirming the argument spelling, the problem persisted. I found a misplaced "end" in my function. After moving the "end" to the correct line, the problem was solved.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!