Simulink model compilation on deployment (mcc and docker image)

조회 수: 6 (최근 30일)
Eduardo
Eduardo 2022년 12월 13일
답변: Aniket 2024년 9월 19일
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?

답변 (1개)

Aniket
Aniket 2024년 9월 19일
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!

카테고리

Help CenterFile Exchange에서 Deploy Standalone Applications에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by