How to use App Designer helper functions as Simulink callback methods.

I am running a simulink model from app designer which plots the simulink output. For this I’m using Event Listener method approach.

The code I used in Simulink ‘StartFcn’ is :

blk2 = 'SineWave/Scope';
event = 'PostOutputs';
listener = @updateAxes;
% Create the listener
h1 = add_exec_event_listener(blk2, event, listener);

Here the updateAxes is an .m script that updates the App Designer axes. This runs without errors as a separate script.

But, I want to create a helper function in my app and use it as the above listener ‘updateAxes’ function. is it possible?

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

“Simulink software can register a listener only while a simulation is running. Invoking this function when no simulation is running results in an error message. To ensure that a listener catches all relevant events triggered by a model’s simulation, you should register the listener in the model’s StartFcn callback function (see Callbacks for Customized Model Behavior).”

That tells us that you cannot directly register the listener from within App Designer.

And that means in turn that the challenge is that when you do the @updateAxes equivalent, that the function you register must be visible inside the StartFcn.

It appears to me that app designer

SEE COMPLETE ANSWER CLICK THE LINK

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.