About linking an m file to a GUI
1 回表示 (過去 30 日間)
古いコメントを表示
I am working on a project to analyse some signals after finishing the code my supervisor asked me to do GUI and I have no idea about that one. I made the interface but the problem I can't understand the callback codes so I can change the code properly to get along with the m.file. In the interface I have a pop-up list in which i should call a list of signals from a database. I have some pushbotton that should make some changes on the figure and some others to show a list of results. values that should be entred by the user to be changed in the m.file code. I guess these are many questions to ask but I really need help
7 件のコメント
Adam
2017 年 6 月 5 日
15 pushbuttons implies 15 entry points which implies 15 functions (at least). The fact that they are all related doesn't mean they can't still be broken up. The GUI and, for example, the handles structure, is the glue that holds it together by storing the data in a way that it is accessible in all callbacks.
回答 (1 件)
ES
2017 年 6 月 5 日
callbacks are simple function that execute on an event (for example a push button press). assume that you have value in an edit box1 (editbox1). assume that you have a value in another edit box(editbox2). assume that you have a push button(pushbutton1) upon pressing which the sum of values is edit box1 and edit box2 are computed and displayed in edit box 3.
The code has to be implemented as a callback of the push button. the code will look like,
function pushbutton1_callback(handles, hObject....)
EB1Value = str2num(get(handles.editbox1, 'string'));
EB2Value = str2num(get(handles.editbox2, 'string'));
sum_EB = EB1Value+Eb2Value;
set(handles.editbox3, 'String',num2str(sum_EB));
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!