MATLAB Answers

Simulink model "running" from stand-alone "app designer" app

47 views (last 30 days)
Aitor  Milo
Aitor Milo on 31 Mar 2020
Commented: Ro Os on 9 Mar 2021
I am developing an app with app designer. The app employs Simulink models. I want to use the app through the standalone Desktop App.
The app runs/works correctly in the Matlab environment. However, I use the MATLAB compiler to create the app, then I execute the app and the app fails when the simulink code is executed.
How can I run a Simulink model with a standalone desktop app?
Thank you in advance
Aitor  Milo
Aitor Milo on 31 Mar 2020
It is a digital twin of a dynamic industrial process (with some inertias and variabilities). The tool takes a simplified version of the process and recreates it for an end user perspective (and expertise). It is a complex code which we have developed in simulink environment and now we want to transfer it to the customer.
Maybe it is possible to recreate it in a matlab script, however, as we are in the final step of the app designer (the stand alone test) we were wondering if is possible to run/call simulink models (.slx) with the stand alone version.
We thought so, because in the app designer environment works. But now we are not sure. It is not possible to run the simulink with the standalone version of app designer?
Thank you for your comment!

Sign in to comment.

Accepted Answer

Kojiro Saito
Kojiro Saito on 1 Apr 2020
Yes, sim command does not work in MATLAB Runtime as of R2019b, so applications which use Simulink models cannot directly compile with MATLAB Compiler.
From R2020a, Simulink Compiler has released. With this toolbox as well as MATLAB Compiler, sim command can be compiled as a standalone application.
For limitation of Simulink Compiler, here is a list of toolboxes, functions and Simulink blocks which MATLAB Compiler / Simulink Compiler support.
Ro Os
Ro Os on 9 Mar 2021
Thank you for your response.
I have tried to emplement the example you mentioned on my code but still i have same problem.
I am using simout as the following:
simout = sim('BatteryRCDvF_10Hz_NMC','StartTime',num2str(app.StartTimeSecEditField.Value), 'StopTime', num2str(app.EndTimeSecEditField.Value) ,'FixedStep', num2str(app.StepTimeEditField.Value));
and then I plot it as the following:
plot(app.UIAxes, simout.SineWaveValue.Time, simout.SineWaveValue.Data);
(This is only a part of my code).
Knowing than i am using To Workspace to link between my App and Simulink Model.
Any help please?
Thank you in advance.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!