Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Call several handles with the same name

1 回表示 (過去 30 日間)
Birch
Birch 2017 年 9 月 8 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I need a bit of help. I have 40 handels called handles.rgb1-handles.rgb40. Is it possible to call all of them without calling them one at the time?
  1 件のコメント
Stephen23
Stephen23 2017 年 9 月 8 日
編集済み: Stephen23 2017 年 9 月 8 日
Next time use a non-scalar structure rather then putting an index into the fieldnames. Then your code will be a lot simpler.

回答 (1 件)

OCDER
OCDER 2017 年 9 月 8 日
編集済み: OCDER 2017 年 9 月 8 日
I think dynamic field names are what you want to use.
for j = 1:40
ThisHandle = handles.(['rgb' num2str(j)]); %Use dynamic field names
%Do something with ThisHandle
end

この質問は閉じられています。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by