About linking an m file to a GUI

1 view (last 30 days)
wissal dakhli
wissal dakhli on 4 Jun 2017
Commented: wissal dakhli on 5 Jun 2017
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 Comments
Adam
Adam on 5 Jun 2017
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.
wissal dakhli
wissal dakhli on 5 Jun 2017
adam thank you very much I didn't try it yet but I guess your answer is helpful thank you very much

Sign in to comment.

Answers (1)

ES
ES on 5 Jun 2017
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));

Categories

Find more on Variables in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!