Info
此问题已关闭。 请重新打开它进行编辑或回答。
Check varaibles from other GUI functions?
1 次查看(过去 30 天)
显示 更早的评论
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..
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!