Can you make a section of a GUI jump back to another?
1 view (last 30 days)
Show older comments
Blair Armstrong
on 21 Apr 2019
Commented: Blair Armstrong
on 21 Apr 2019
I'm currently making a GUI that essentially filters data based on different parameters and then graphs the answer.
This group of radio buttons changes the filtering parameters and thus changes the answer you get.
I was wondering if you can use the MATLAB GUI syntax to help aid in this process. Here's the code for the radiobutton callback. I want it to automatically branch back to the filter function part of the GUI without having the copy and paste the code again that makes it display. Is there any function/command that will essentially say "go back to this part of the GUI code"?
% --- Executes when selected object is changed in waveselection.
function waveselection_SelectionChangedFcn(hObject, eventdata, handles)
% hObject handle to the selected object in waveselection
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Changes the
switch(get(eventdata.NewValue,'Tag'));
case 'deltawave'
handles.filterFreqs = [1 5];
case 'alphawave'
handles.filterFreqs = [7 16];
case 'betawave'
handles.filterFreqs = [14 41];
case 'gammawave'
handles.filterFreqs = [29 101];
end
guidata(hObject, handles);%Updates handles structure
Thank you greatly for any and all help!
0 Comments
Accepted Answer
Walter Roberson
on 21 Apr 2019
Edited: Walter Roberson
on 21 Apr 2019
Create a function that does the functionality you want to "branch back to". Call that function from both callbacks. No duplicated code, just two places that call the same code.
More Answers (0)
See Also
Categories
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!