change the color of a block based on its output

조회 수: 2 (최근 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 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