Writing Callback For GUI
古いコメントを表示
Hello Everyone ! I am experiencing a problem while writing callback for pushbutton in GUI. The problem is that the function that ,is calculated in the callback , is represented by other 5-6 functions ,which also depend on user inputs ( also from GUI) . I would be extremely grateful if anyone could give a piece of advice on how to implement it in Matlab. Thanks in advance! Best Regards
2 件のコメント
Jarrod Rivituso
2011 年 4 月 5 日
Are you getting any errors when trying to call these other functions from within your callback? If so, are the other functions in separate MATLAB files? Are they on your MATLAB path?
Dimitry
2011 年 4 月 6 日
採用された回答
その他の回答 (3 件)
Matt Fig
2011 年 4 月 6 日
0 投票
Where would you get the values for the functions? If you are wanting to get them from other uicontrols (editboxes, for example), then you must query the correct property of the uicontrols from within the pushbutton callback.
Tell where you would like to get the inputs to the separate functions...
4 件のコメント
Dimitry
2011 年 4 月 6 日
Matt Fig
2011 年 4 月 7 日
In the callback to the pushbutton, you simply query the 'string' property of the editboxes. If you are expecting numeric values, remember to convert them first.
N1 = str2double(get(editbox1handle,'string'));
N2 = str2double(get(editbox2handle,'string'));
N3 = str2double(get(editbox3handle,'string'));
...etc
The handles to the editboxes can be obtained through the handles structure, or by calling GUIDATA or GUIHANDLES.
Dimitry
2011 年 4 月 8 日
Matt Fig
2011 年 4 月 8 日
The more information I have, the better I can help you. So:
WHAT ERROR?
Please show the entire error message!
Also, what do you mean "the function that also depends on them?" You need to be a lot clearer in what you are trying to do. It was my understanding that you had several M-file functions in different files which you wanted to run when a pushbutton was pressed. Further, the arguments to these function M-files were to be taken from the editboxes in the GUI. So they are the functions that depend on these values, so what do you mean by "function that is executed in the callback also depends on them . "
Please, if you want help, be VERY clear about what is supposed to happen when the button is pushed.
Dimitry
2011 年 4 月 8 日
2 件のコメント
Oleg Komarov
2011 年 4 月 10 日
I suggest to give a look at http://www.mathworks.com/matlabcentral/fileexchange/24861-41-complete-gui-examples
Dimitry
2011 年 4 月 10 日
カテゴリ
ヘルプ センター および File Exchange で Migrate GUIDE Apps についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!