GUI handles.*** vs hObject
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi guys,
Currently I am doing some GUI programing. (I am a newbie in this so if there is something wrong, please feel free to give me advices).
I have a radio button along its callback function. Along with that, I also produce another function to do some calculation/condition checking.
function Evaluation
if <obey condition>
set(handles.radiobutton,'Value',1);
guidata(handles.output, handles);
<radiobutton call back>
function <radiobutton callback> hObecj eventdata handles
chck = get(hObject,'Value');
if get(hObject,'Value') == 1 then
%do this
else
%do that
Surprisingly, the value I get for chck is not as it should be (it should be 1 but it appeared to be 3). Spending ages stopping and watching step-by-step, I still have no clue how to solve it.
Thanks for your help.
댓글 수: 0
답변 (1개)
Muthu Annamalai
2013년 8월 30일
I understand you are having problems accessing a property of the radio-button class.
Since radio buttons behavior is different from other widgets in that, they are all grouped together, in a mutually exclusive fashion, and one of them is always true.
So you need to identify,
a) which of n radio buttons were selected b) and properties of the selected radio button..
So it seems to me you already know button 3 was "selected," implicitly meaning its value is true.
Also, to keep under your pillow, http://www.mathworks.com/help/matlab/ref/uibuttongroup.html?searchHighlight=radio+button
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!