Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How to link pushbotton and a m file(script)
1 回表示 (過去 30 日間)
古いコメントを表示
Hi I don't know how to call a m file(script) through a pushbotton...I know that i have to do do something in the function pushbotton_Callback(......) but i don't Know what.. I tried this..
but nothing.
It appears me the following warning:
0 件のコメント
回答 (6 件)
Walter Roberson
2011 年 11 月 9 日
addpath() is only for use with directories, not individual files.
If you just want to execute the script, use run() -- but note that run() changes directories, so addpath() is better if you need to execute in the current directory.
Remember there is no point in using addpath() twice with the same path, so you may wish to check whether the target path is already on the path.
0 件のコメント
Vincenzo
2011 年 11 月 10 日
3 件のコメント
Walter Roberson
2011 年 11 月 10 日
The variables *are* being created, in the workspace of pushbutton2_Callback, and so they disappear again as soon as that callback finishes executing.
If you need your script to put the variables in the base workspace, then have it specifically put them there, such as by using assignin()
By the way, your code uses constructs that haven't been necessary since MATLAB 5.
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!