매트랩 공부 중 다음과 같은 에러가 내 머리를 울리게 한다.. Attempt to execute SCRIPT as a function. 해결방법은 다음과 같다. 출처는  MATLAB Answers Answer by  MathWor...

Attempt to execute SCRIPT as a function.

매트랩 공부 중 다음과 같은 에러가 내 머리를 울리게 한다..

Attempt to execute SCRIPT as a function.

해결방법은 다음과 같다. 출처는 MATLAB Answers

Answer by MathWorks Support Team on 12 Dec 2012
 Accepted answer
Explanation:
You are attempting to call a script file as though it were a function file by passing arguments to it.
Common causes:
1. You have created a script MATLAB file with the same name as a function on the MATLAB path but higher on the path than that function;
2. You are attempting to index into an array that does not exist when a script file with that name exists.
Solution:
Execute
>> which -all ‹filename›
for the file specified in the error message. Verify that the file you expect to execute is being used instead of any other file with the same name. If it is not, rename or delete the files higher on the MATLAB path than the file you expect to use, or reorder the directories on your MATLAB path to place the version of the file you want to use higher than any other version.
The attached example ("AttemptExecuteScriptAsFunction.m" and "TestScriptAsFunction.m") demonstrates this error. Save these files in your current folder and execute at the MATLAB prompt:
>> AttemptExecuteScriptAsFunction

0 개의 댓글: