How can I set properties (e.g. backgroundcolor) of a Simulink Area programmatically?
조회 수: 44 (최근 30일)
이전 댓글 표시
Hi,
I've been trying to change the background color of a Simulink Area programmatically but without effect. I can use get/set to change the value of the property backgroundcolor, but this has no influence on the displayed color. On the other hand, if I change the color manually via the context menu, the value returned for backgroundcolor will change accordingly, so it does appear to be the correct property to look at.
Thanks! Ruben
댓글 수: 1
Torsten Knodt
2016년 10월 10일
What exactly do you mean by "Simulink Area"? I have checked for a block and can modify the background color, e.g. with
set_param(gcb,'BackgroundColor','red')
채택된 답변
Monika Jaskolka
2017년 12월 7일
The available properties for Simulink Areas are described here: https://www.mathworks.com/help/simulink/slref/simulink.annotation.html
To change the background color property of a Simulink Area that is currently selected, do the following:
handle = find_system(gcs, 'FindAll', 'on', 'type', 'annotation', 'AnnotationType', 'area_annotation', 'selected', 'on')
set_param(handle, 'BackgroundColor', 'green')
This works for me on 2017b.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!