Automating Simulink Code Generation from DOS Command Window
Show older comments
First, I am relatively a newbie for MatLab and Simulink - surrounded by very smart ME's writing very cool stuff.
What I want to do is take all of the manual point and click and turn this into a batch file to run from a DOS Command Window in order to load the models and generate the code for all of the models.
What I am attempting to create is an automated build script to run at night in batch mode. Pull all code from our Configuration Management tool, build all models, and then compile.
I am using MatLab 2011b, Simulink Coder, and TI Code Composer 5 (Eclipse)
Can someone point me at a tutorial or instructions on how to do this. I have been searching for answers to this question for a while and finally decided to just ask the question.
Thank you in advance.
David Clark LORD Corporation
1 Comment
Mady J
on 4 Sep 2018
Hello David, My scenario is also same as yours. I need to know is there any document or website from where i can get complete list of windows command for matlab and simulink code generation.
Thank you Mady
Accepted Answer
More Answers (1)
Fangjun Jiang
on 15 Dec 2011
0 votes
There are many things involved. But at the high level, you just need to set up two things. Of course, all the related files, configurations, etc have to be tested. I think your question is primarily about how to set up the automation assuming you've been able to do individual task successfully.
- From DOS command, you can start MATLAB with the -r optoin. "MATLAB -r MyCodeGenRoutine" will start MATLAB and then run MyCodeGenRoutine.m automatically.
- In your MyCodeGenRoutine.m, basically you need three lines. "open_system(Model);rtwbuild(Model);close_system(Model)'
- If you have multiple models, than you can put the three lines in a loop. After it's done, you can use "exit" command to close MATLAB.
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!