Info

This question is closed. Reopen it to edit or answer.

Check varaibles from other GUI functions?

1 view (last 30 days)
Edmund Paul Malinowski
Edmund Paul Malinowski on 18 Nov 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
Hey all,
I'm trying to set up a GUI for my program and have a few issues. For one part of it, I have 3 radio buttons and a button in a button group. I've set up the functions for the selection change of the radio buttons and i set up a variable to be either 1, 2 or 3 depending on the selection but the button which performs the main part of the program seems to error when i try to read the variable from the radio button selection change function.. Below is my code so far:
% **********************************************
% OPTION BUTTONS SELECTION..
% **********************************************
% --- Executes when selected object is changed in uibuttongroup1.
function uibuttongroup1_SelectionChangedFcn(hObject, eventdata, handles)
% CHECK WHICH RADIO BUTTON IS SELECTED..
switch get(eventdata.NewValue,'Tag');
case 'OptUNFT'
FiltX = 1;
msgbox({'UNFILTERED NOTE..', num2str(FiltX)});
case 'OptISOLATE'
FiltX = 2;
msgbox({'ISOLATE NOTE..', num2str(FiltX)});
case 'OptFTNT'
FiltX = 3;
msgbox({'FILTER THE NOTE..', num2str(FiltX)});
end
% END SWITCH..
% **********************************************
% APPLY FILTER BUTTON..
% **********************************************
% --- Executes on button press in btAPLLYFT.
function btAPLLYFT_Callback(hObject, eventdata, handles)
% hObject handle to btAPLLYFT (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
switch FiltX;
case 1
msgbox('You chose to play the original');
case 2
msgbox('You chose to isolate');
case 3
msgbox('You chose to filter');
end
% END SWITCH..
By the way, i only have msgbox simply to check things are working as i go.. I don't know enough yet about matlab but in other languages, i'm sure it would be because FiltX is a local variable to that function, Is that right?
If its not this, how can i pass the FiltX value to the button press function..
Excuse my poor terminology haha..
Thanks,
Paul..

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!