MATLAB Answers

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

154 views (last 30 days)
Joseph
Joseph on 4 Jul 2019
Commented: We Kai on 10 Mar 2020
I have tried using the following command but it did not work:
app.mylamp.Color = [0.3010 0.7450 0.9330]
Thanks

  0 Comments

Sign in to comment.

Answers (1)

Kevin Chng
Kevin Chng on 4 Jul 2019
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 Comments

Joseph
Joseph on 4 Jul 2019
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.....

Sign in to comment.

Sign in to answer this question.


Translated by