How do I generate a C code from a Simulink model directly from command line?

조회 수: 5 (최근 30일)
I'm currently developing a CI project to build on Jenkins, from which one of the steps is to generate C code form a Simulink model. To implement it, a MATLAB command is required. However, I wasn't able to find any documentation indicating how to do that.
Does anyone know how to generate a C code from a Simulink model directly from command line?

채택된 답변

Sourabh Kondapaka
Sourabh Kondapaka 2020년 11월 6일
편집: Sourabh Kondapaka 2020년 11월 6일
The MATLAB command to generate C code from a Simulink Model is "rtwbuild()".
You can check the documentation for "rtwbuild()" function here
To execute Matlab code within Jenkins you will need to install "MATLAB" Jenkins plugin linked here
For a refresher on using Jenkins CI with MATLAB a good place to start would be this Technical Article
For a model named "CruiseControlMode.slx", your Jenkins build step should look something like this:
( Assuming CruiseControlMode.slx model is in the MATLAB path )

추가 답변 (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