change the color of a block based on its output

1 回表示 (過去 30 日間)
grapevine
grapevine 2012 年 2 月 24 日
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 Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by