"Undefined function or variable" in GUIDE
1 回表示 (過去 30 日間)
古いコメントを表示
I have a script who replace some values. The problem is that when i click the action button for firt time, it work, but second give me this error :
Undefined function or variable 'redenumire'.
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)redenumire('renamebtn_Callback',hObject,eventdata,guidata(hObject))
How can i solve this ? I'm totally at the start with Matlab, and i can't find a response for my question on internet.
0 件のコメント
回答 (1 件)
Walter Roberson
2017 年 9 月 14 日
You code might be cd'ing (changing directory) away from the directory that holds the .m file for your code.
2 件のコメント
Walter Roberson
2017 年 9 月 14 日
Right. You cd to calea but you do not cd back. After the first cd, your script redenumire.m is no longer in your current directory and MATLAB cannot find it to execute the code.
- avoiding cd is generally more robust
- if you do cd then do so only in the context of
olddir = pwd;
try
cd(newdir)
...
catch
end
cd(olddir)
Even that is risky as it cannot handle running out of memory or the user using control-C
参考
カテゴリ
Help Center および File Exchange で File Operations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!