Simulink model compilation on deployment (mcc and docker image)

6 visualizaciones (últimos 30 días)
Eduardo
Eduardo el 13 de Dic. de 2022
Respondida: Aniket el 19 de Sept. de 2024
Right now I am looking for the best way to deploy a simulink model as a standalone application which I can run multiple times in the cloud.
For now I have seen two possibilities of deployment:
  • Create an .exe file using mcc
  • Create a docker image of a matlab function running the model
I have based both solutions on the script given at Deploy with Simulink Compiler
When running the command to create the .exe file:
mcc -m deployedScript.m
I have seen in the command window that the model is being compiled:
### Building the rapid accelerator target for model: sldemo_suspn_3dof
### Successfully built the rapid accelerator target for model: sldemo_suspn_3dof
Build Summary
Top model rapid accelerator targets built:
Model Action Rebuild Reason
===============================================================================
sldemo_suspn_3dof Code generated and compiled buildInfo.mat does not exist.
Does this mean that the created executable contains a compiled copy of the model? or does the compilation happen each time that the application is executed?

Respuestas (1)

Aniket
Aniket el 19 de Sept. de 2024
Creating an executable using the mcc command with Simulink Compiler involves compiling the Simulink model into a standalone binary format. This process generates and compiles C code from the model, which is then packaged into an executable (.exe file) along with any MATLAB code and dependencies.
The build message (### Building the rapid accelerator target for model: sldemo_suspn_3dof) indicates that this compilation occurs once during the creation of the executable. The compiled model is included within the executable, so it does not recompile each time you run it. This setup allows the application to run independently of MATLAB or Simulink and provides faster execution times.
For cloud deployment, using an .exe file is suitable for Windows environments, enabling standalone execution. Alternatively, creating a Docker image offers platform independence and scalability, making it ideal for cloud environments that use container orchestration. The choice depends on your cloud platform, operating system environment, and scalability needs.
You may refer to the following documentation to get help for packaging MATLAB standalone app into Docker Image:
I hope this clears things up!

Categorías

Más información sobre Deploy Standalone Applications en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by