I wanted to run a Simulink model in External mode and I am new to App Designer. To begin with I started working in Normal mode. Here is the example:
My Simulink Model: with sine wave Amplitude Variable as 'Const';
The 'to workspace is in TimeSeries format. App Desiner Model: This has two Numeric Edit Fields(Amplitude, Duration), one Axis for plotting and start button.
Callback fn code when the start button is pushed is below:
simout = sim("AppDesignSetup.slx",'StopTime', num2str(app.DurationEditField.Value));
I get no error and also the output graph
NOW MY PROBLEM::
when I try same way to run a external mode model, Matlab suggested me to use 'set_param' to run a model in external mode.
So, to learn about 'set_param' , I started with the same model in Normal Mode with the callback fn code :
set_param('AppDesignSetup/Sine', 'Amplitude', num2str(app.AmplitudeEditField.Value));
set_param('AppDesignSetup', 'SimulationMode', 'normal');
In this the program runs perfectly until the 'plot' command. The Simulink model runs perfectly and get an 'out' struct.
But I'm unable to access it. Someone please help me with this.