フィルターのクリア

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