필터 지우기
필터 지우기

How can I change the color of a subsystem during simulation based on the value of an input signal ?

조회 수: 1 (최근 30일)
Hello,
I would like to change the color of a subsystem if the input signal exceeds a constant value (or another signal). I found this function (found here : http://fr.mathworks.com/matlabcentral/answers/97099-how-can-i-change-the-color-of-a-subsystem-during-simulation-based-on-the-value-of-an-input-signal-in ) :
function y = fcn(u, t)
%#eml
eml.extrinsic('set_param','get_param','gcs');
y = u;
if u > t
set_param(get_param(gcs,'parent'),'BackgroundColor','red');
else
set_param(get_param(gcs,'parent'),'BackgroundColor','white');
end
But when I try it I get 3 error codes that I don't understand : 1) Unsupported n-D matrix access for n>2. Function 'Subsystem/Embedded MATLAB Function' (#76.131.175), line 7, column 1: "eml.extrinsic('set_param','get-param','gcs')"
2) Unsupported: structure access Function 'Subsystem/Embedded MATLAB Function' (#76.131.144), line 7, column 1: "eml.extrinsic".
3) Errors occured during parsing of Embedded MATLAB function 'Subsystem/Embedded MATLAB Function' (#76).
To simplify, I have a signal that can be 0 or 1, and I would like to have a subsystem block green if the signal is 0 and red if it is 1.
Could you help me please ? I use simulink 6.3 (2005).
Thank you

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by