change the color of a block based on its output

2 次查看(过去 30 天)
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?

采纳的回答

Guy Rouleau
Guy Rouleau 2012-2-24
  1 个评论
grapevine
grapevine 2012-2-27
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!!!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Event Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by