App Designer - increment component

1 回表示 (過去 30 日間)
Marc Servagent
Marc Servagent 2021 年 4 月 9 日
コメント済み: Marc Servagent 2021 年 4 月 13 日
Hello,
I try to increment the name of a component in app designer, in order to create a loop,
hereafter an example:
for i=1:8
app.Lamp.Color_i = [0 0 0]
end
Of course, the above example does not work, I tryed several type of concantenate functions, and also eval function, but I did not succed.
Thanks in advance for any help !

採用された回答

Monisha Nalluru
Monisha Nalluru 2021 年 4 月 12 日
From my understanding, you want to access the uilamp present in the app using app designer.
If uilamps are named as Lamp1, Lamp2, Lamp3 and so on.
Then you can access them using the following statement
for i=1:8
app.("Lamp"+i).Color = "red";
end
Hope this helps!
  1 件のコメント
Marc Servagent
Marc Servagent 2021 年 4 月 13 日
Thanks, Monisha, for your help, I did not expect to be as simple as that ...!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by