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 Center および File ExchangeInteractive 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