I have a Simulink model set up with event listeners so that I can access the simulation data while it runs. To do this, I followed the instructions from this documentation link:
The issue is that I want to create multiple event listeners so that I can access the data of many blocks from the simulation, but I can't seem to figure out how to do this. I tried placing the following code in the "StartFcn" model callback, but it only created the last listener in the loop:
blockName=find_system(mdl);for i=1:length (blockName)-1blkRTO = get_param(blockName{i+1},'RuntimeObject');h=add_exec_event_listener(blkRTO,'PostOutputs',@change_block_color);end
Best Answer