loop on handles on GUI

조회 수: 2 (최근 30일)
Nicolas
Nicolas 2021년 10월 22일
댓글: Nicolas 2021년 10월 22일
I have issue to perform a loop on handles in a GUI
I have 9 checkboxs named checkbox1....checkbox9. I can easily access to values
I tried to do that :
for i= 1: 9
temp=strcat('handles.checkbox',num2str(i));
if get(temp,'Value')==1;
pooled_values= pooled_values+values(i,:);
end
end
I also tried to convert the string to a function handle with "str2func"
So obviously a strinf isn't an handle and I am wondering how to do what I want ?
Thank you for the help

채택된 답변

Stephen23
Stephen23 2021년 10월 22일
fnm = sprintf('checkbox%d',i);
handles.(fnm)
  댓글 수: 1
Nicolas
Nicolas 2021년 10월 22일
Thank you !

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by