MATLAB: How to create an executable from the Simulink model to send to someone who does not have MATLAB

alonecodercompilerexecutablesimulinkstandstand-alone

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.

Best Answer

Depending on what you are looking for, there are two approaches you may consider:
First, 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. With Simulink Compiler, the standalone executables can be complete simulation apps that use MATLAB graphics and UIs designed with MATLAB App Designer. End users do not need full MATLAB or Simulink installations, they only need to install MATLAB Runtime to run and use the compiled simulation.
For an illustration of compiling a standalone simulation and including an App built with App Designer, refer to the following example:
To install MATLAB Runtime, direct end users to the following website:
Secondly, 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":
For more information on the differences between Simulink Compiler and Simulink Coder, refer to the following documentation page: