change the color of a block based on its output

2 views (last 30 days)
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?

Accepted Answer

Guy Rouleau
Guy Rouleau on 24 Feb 2012
  1 Comment
grapevine
grapevine on 27 Feb 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!!!

Sign in to comment.

More Answers (0)

Categories

Find more on Event Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!