How can I create an executable from my Simulink model to send to someone who does not have MATLAB?

211 views (last 30 days)
I want to be able to create an executable for my Simulink model to send to someone who does not have MATLAB or Simulink installed on their computer.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 24 Sep 2021
Edited: MathWorks Support Team on 24 Sep 2021
Depending on what you are looking for, there are two approaches you may consider:
1. Simulink Compiler
Simulink Compiler enables you to share Simulink simulations as standalone executables starting in R2020a. If you require variable-step solvers, or need to deploy the simulation including graphics, an App, or other Simulink semantics not supported for code generation, you should use Simulink Compiler.
Simulink Compiler enables you to build simulation executables by packaging the compiled Simulink model and the MATLAB code to set up, run, and analyze a simulation. The standalone executables can be complete simulation apps that use MATLAB graphics and UIs designed with MATLAB App Designer. Refer to the following example:
Simulink Compiler also allows you to deploy a model to experiment and tune simulation parameters. Refer to the following example:
End users do not need full MATLAB or Simulink installations, they only need to install MATLAB Runtime to run and use the compiled simulation. To install MATLAB Runtime, direct end-users to the following website:
See the Simulink Compiler product page for more information about the product:
2. Simulink Coder
Simulink Coder generates optimized, portable, and customizable code from Simulink models. If you need to create a stand-alone executable for a model just in order to run the simulation, you can use Simulink Coder to build your model with the generic real-time (GRT) target.
The generic real-time (GRT) target provides an environment for simulating models using a fixed-step solver in single or multitasking mode. An executable generated with the GRT target runs your model as a stand-alone program on your workstation. The executable will run as fast as possible, and therefore is a non-real-time simulation.
By default, executables generated with the GRT target will support only fixed-step solvers, and only Simulink blocks and features supported for code generation are supported under this workflow. With this in mind, Simulink Compiler offers enhanced functionality and is typically better-suited to sharing and deploying applications for users without MATLAB or Simulink.
The following documentation page describes how to build an executable from a Simulink model using the 'StandaloneCoderTarget' option with "slbuild":
See the Simulink Coder product page for more information about the product:
For more information on the differences between Simulink Compiler and Simulink Coder, refer to the following documentation page:
Stefanie Schwarz
Stefanie Schwarz on 24 Sep 2021
We do not support Simulink Desktop Real-Time (SLDRT) for standalone operation with Simulink Compiler at this point. Feel free to contact MathWorks Technical Support about this so we can forward your request to development.
There is no point in trying to generate standalone C/C++ code from any SLDRT blocks, these blocks have no meaning outside of Simulink because they are designed to specifically interact with the real-time kernel shipped with the product.

Sign in to comment.

More Answers (2)

fayçal ahmed zaid
fayçal ahmed zaid on 11 Aug 2016
Hi, I have the same problem, i'd like to run my executable and interact with the I/O without using any simulink interface, is it possible ?

fayçal ahmed zaid
fayçal ahmed zaid on 18 Aug 2016
After a long time of research here and there, I think you'll need to get the Embedded Coder Toolbox, in order to deploy your executables for PC without Matlab nor Simulink.

Community Treasure Hunt

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

Start Hunting!