MATLAB Answers

How to change the color of a lamp component when a button is pressed in AppDesigner ?

109 ビュー (過去 30 日間)
Joseph
Joseph 2019 年 7 月 4 日
コメント済み: We Kai 2020 年 3 月 10 日
I have tried using the following command but it did not work:
app.mylamp.Color = [0.3010 0.7450 0.9330]
Thanks

  0 件のコメント

Sign in to comment.

回答 (1 件)

Kevin Chng
Kevin Chng 2019 年 7 月 4 日
It should be working. I guess you miss out something, i try to do the full workflow here : I hope it helps you
1) Create button and lamp
1.png
2) Create callback function for button
1.png
3) Inside the callback function type
1.png
4) Ensure app.Lamp is the component's name
1.png
Let me know if you still cant do it.

  3 件のコメント

Joseph
Joseph 2019 年 7 月 4 日
I had this exact set up and it still did not work. I also tried:
app.mylamp.Color = 'blue'
and that still did not work unfortunatly.....
Kevin Chng
Kevin Chng 2019 年 7 月 4 日
It is strange, try with different colour
app.mylamp.Color = [0.2 0.2 0.2]

Sign in to comment.


Translated by