How can I change color of Push Button in Simulink GUI or add a picture?
조회 수: 5 (최근 30일)
이전 댓글 표시
I have a push button in Simulink GUI, but I can't change its color. When I try to set the background or foreground colors from the properties menu, it doesn't display on the button - it still stays white.
Is there a way to do it programmatically? I tried using the MATLAB GUI push button options, but that approach doesn't work with Simulink.
Or is there a way to add a picture in the button instead of only text?
댓글 수: 0
답변 (1개)
Gouri Chennuru
2020년 8월 12일
Hi Diana,
Yes, You can update the background color by using the set function which is used to set all the graphics object properties.
You can set the background color to the push button in this manner,
set(Objectname,'BackgroundColor',[0,0,0]);
You can also set the background image to the push button using set function as follows,
set(Objectname, 'CData', bg_image);
Hope this Helps!
참고 항목
카테고리
Help Center 및 File Exchange에서 String에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!