필터 지우기
필터 지우기

Change string of pushbutton from radio button callback?

조회 수: 1 (최근 30일)
Edmund Paul Malinowski
Edmund Paul Malinowski 2015년 11월 23일
댓글: Edmund Paul Malinowski 2015년 11월 24일
Hey all,
I'm trying to change the string of a pushbutton dynamically depending on which radio button is selected but my code is off and errors. It must be something really simple i'm missing. Here's my code:
% **********************************************
% OPTION BUTTONS SELECTION..
% **********************************************
% --- Executes when selected object is changed in uibuttongroup1.
function uibuttongroup1_SelectionChangedFcn(hObject, eventdata, handles)
% DECLARE GLOBAL VARIABLES IN FUNCTION..
global FiltX; % VARIABLE FOR WHICH FILTER OPTION IS SELECTED..
% SWITCH: CHECK WHICH RADIO BUTTON IS SELECTED..
switch get(eventdata.NewValue,'Tag');
case 'OptPITCHDET'
FiltX = 1;
set(hObject.btAPPLYFT,'String','DETECT PITCHES..');
case 'OptISOLATE'
FiltX = 2;
set(hObject.btAPPLYFT,'String','APPLY & LISTEN..');
case 'OptFTNT'
FiltX = 3;
set(hObject.btAPPLYFT,'String','APPLY & LISTEN..');
end
% END SWITCH..
% **********************************************
Any ideas?
Thanks,
Paul..

채택된 답변

Joseph Cheng
Joseph Cheng 2015년 11월 23일
change hObject to handles so
set(hObject.btAPPLYFT,'String','DETECT PITCHES..');
turns to
set(handles.btAPPLYFT,'String','DETECT PITCHES..');
  댓글 수: 3
Joseph Cheng
Joseph Cheng 2015년 11월 23일
Well without seeing the rest of your code the only thing i can suggest is double check that the tag is spelled correctly and has the exact case in lettering.
Edmund Paul Malinowski
Edmund Paul Malinowski 2015년 11월 24일
Hey Joseph, hahaha it was something so simple. The actual pushbutton was incorrectly named btAPLLYFT. I didn't spot it at first. That will teach me to read, write and spell haha. Thanks :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by