Can you make a section of a GUI jump back to another?

1 回表示 (過去 30 日間)
Blair Armstrong
Blair Armstrong 2019 年 4 月 21 日
コメント済み: Blair Armstrong 2019 年 4 月 21 日
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!

採用された回答

Walter Roberson
Walter Roberson 2019 年 4 月 21 日
編集済み: Walter Roberson 2019 年 4 月 21 日
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.
  1 件のコメント
Blair Armstrong
Blair Armstrong 2019 年 4 月 21 日
Okay that makes sense, any exceptionally weird syntax when calling a function inside a GUI instead of just 'regular' code? Or just the usual stuff (i.e. making sure its in the same directory)?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by