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

154 次查看(过去 30 天)
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.

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2021-9-24
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:
  2 个评论
Michael
Michael 2021-9-21
@Marian Kersting I don't see this in the list of blocks in R2021a. Is this what you were refering to?
I have tried using the Real-Time Desktop Blocks and including the Real-Time Sync block, but when I jump over to Simulink Coder I don't get an executable like I did when I was using the grt.tlc file.
Stefanie Schwarz
Stefanie Schwarz 2021-9-24
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by