change the color of a block based on its output

1 visualización (últimos 30 días)
grapevine
grapevine el 24 de Feb. de 2012
hello,
I'm wondering if there is any way to change a color of a block as a function of the output value.
I thought to use this command
set_param('Test_Forcage_4_Blocs/FUP4', 'BackgroundColor', '[.1, .3, .5]')
but can we do that without using the simulink block, Matlab fcn?

Respuesta aceptada

Guy Rouleau
Guy Rouleau el 24 de Feb. de 2012
  1 comentario
grapevine
grapevine el 27 de Feb. de 2012
I miss something.........
I understood that I should type this instruction
"
listen=add_exec_event_listener(gcb, 'PostOutputs', @MyFunction)
"
while my simulation is running, but I cannot figure out what it is supposed to write inside the body of Myfunction in order to read the ouput value of the block
"
function CallbackFunction(source,eventData)
...
end
"
I should write this code, don't I?
"
rto = get_param(block,'RuntimeObject')
rto.OutputPort(1).Data
"
ps
I just check your other solution
http://www.mathworks.com/matlabcentral/fileexchange/23127
man, that stuff is awesome!!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Objects en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by