필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How do I run codes in environments other than MATLAB default folder?

조회 수: 1 (최근 30일)
Shawn Miller
Shawn Miller 2015년 10월 6일
마감: MATLAB Answer Bot 2021년 8월 20일
I met the problem when I tried to run the following code written in a script file on my desktop,
[xasterisk,value]=fminsearch(@(x)100*(x(2)-x(1)^2)^2+(1-x(1))^2,[0,0])
then, I get the error "Attempt to execute SCRIPT fminsearch as a function:" then, I copied the code to the command window, and I got the same error. Finally, I decided to change the current folder to MATLAB folder, and the error disappears. So I guess the problem is because some environment setting issues, i.e. I can't visit fminsearch on desktop (Am I right?). So my question is how can I run codes on other folders that I assign (in my case, I usually save files, both scripts and function files on desktop)?

답변 (1개)

Walter Roberson
Walter Roberson 2015년 10월 7일
Go back to the other location and ask for the output of
which -all fminsearch
and tell us what the result is.
The expected output would be in somewhere under your MATLAB installation directory in toolbox/matlab/optimfun/fminsearch.m

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by