Using various event listener to send data from Simulink to GUI

1 view (last 30 days)
Hello,
I'm desperately trying to listen to different blocks from my simulink model. The listeners are executed and work properly. I tried to send it to different static fields in my GUI figure. one field for each block. But it doesn't really work. There are 5 Blocks and it works for only (sometimes 2) one of them. The values of the other 4 blocks are shown in the other static field one after another instead one field one block. A few weeks ago everything worked fine.
I'm not able to figure out the problem. I have no clue why it only works for one / two blocks ?!
the programming for the listeners are all the same:
in the GUI.m File's opening function
rto = get_param('simulink_mdl/blk1','RuntimeObject');
str = num2str(rto.OutputPort(1).Data);
statestxt = findobj('Tag','blk1_field');
set(statestxt,'string',str);
and in the block's callback startfcn
set(0,'ShowHiddenHandles','on');
block_1 = 'Simulink_mdl/blk1';
event = 'PostOutputs';
listener = @GUI.m;
h(1) = add_exec_event_listener(block_1, event, listener);
instead of h(1) I'm using h(2) etc. for the other listeners and instead of block_1 I'm using block_2 etc (blk2...)
Has anybody an idea of what is going on ???
Regards
tutui

Answers (0)

Categories

Find more on Test Model Components 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!