I am designing an app that plots the output of a simulink model. For this I am using Event Listener method. I acheived this by adding the event listener directly in the 'StartFcn' of the simulink model and creating a Script for updating the plot.
But I wanted to add the event listener using methods(functions) of the app(Task_1).
The reuired code for now, that I wrote in the buttonpushedcallback is:
set_param('Task1', 'StartFcn', 'Task_1.addEventListener');
set_param('Task1', 'SimulationCommand', 'start');
Here in the 2nd line, I added the event listener which directs to the static methods that is declaredin the same app, as shown below:
Blk = 'Task1/Scope';
Event = 'PostOutputs';
Listener = @Task_1.execEventListener;
EL = add_exec_event_listener(Blk, Event,Listener);
The problem I am facing here is, when the simulink model strats running, the 'StartFcn callback' executes and enters the addEventListener method(function) and stops at break point1. Now when I press continue, the 'execEventListener' is not executing i.e. the program is not stopping at break point 2 and running the simulink model.
Can someone guide me through this please.
Please show me the right way to use a helper function from app designer to a simulink callback.