GUI : uicontrol values

조회 수: 1 (최근 30일)
Clément P
Clément P 2016년 4월 1일
댓글: Clément P 2016년 4월 1일
Hi everyone,
I have a GUI with several check boxes/togglebuttons/Pushbutton. I want to set the value to 0 of all the uicontols when I push one other. Is there a way to do it either than putting every value to 0.
Currently, I have this code at the beginning of all my callbacks function :
set(handles.tb1,'Value',0);
set(handles.tb2,'Value',0);
set(handles.tb3,'Value',0);
set(handles.box1,'Value',0);
set(handles.box2,'Value',0);
set(handles.box3,'Value',0);
set(handles.box4,'Value',0);
set(handles.box5,'Value',0);
It's working, but it's making my code very long and hard to read.
Thanks, Clément

채택된 답변

Orion
Orion 2016년 4월 1일
Hi,
one way is using findall :
% set all the checkboxes of the current figure to 0 :
set(findall(gcf,'Style','Checkbox'),'Value',0)
% same for togglebuttons
set(findall(gcf,'Style','togglebutton'),'Value',0)
  댓글 수: 1
Clément P
Clément P 2016년 4월 1일
Perfect, I always forgot this function :D

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by