MATLAB Answers

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

조회 수: 162(최근 30일)
Joseph 4 Jul 2019
댓글: Pawel 22 Oct 2020
I have tried using the following command but it did not work:
app.mylamp.Color = [0.3010 0.7450 0.9330]

  댓글 수: 0

댓글을 달려면 로그인하십시오.


Kevin Chng
Kevin Chng 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
2) Create callback function for button
3) Inside the callback function type
4) Ensure app.Lamp is the component's name
Let me know if you still cant do it.

  댓글 수: 4

표시 이전 댓글 수: 1
Kevin Chng
Kevin Chng 4 Jul 2019
It is strange, try with different colour
app.mylamp.Color = [0.2 0.2 0.2]

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by