Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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

Risposte (0)

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by