Automating Simulink Code Generation from DOS Command Window
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Mady J
2018 年 9 月 4 日
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
採用された回答
LIANG
2011 年 12 月 20 日
Hi David,
If you want to turn off the GUI and pop up window, try to run the dos command below options:
> start matlab -nosplash -nodesktop -minimize -noFigureWindows -r <matlab script>
To create a log file, add:
-logfile .\logfile.log
Btw, for those functions to open/close the model in your m-script, you need to add quotation marks like this:
open_system('Model');
rtwbuild('Model');
close_system('Model');
exit
"exit" is to exit Matlab after code generation.
Good luck.
2 件のコメント
Fangjun Jiang
2011 年 12 月 20 日
The way it works is that you specify the model name once so you don't have to change it three times in case it needs to be changed.
Model='F14';
open_system(Model);
rtwbuild(Model);
close_system(Model);
その他の回答 (1 件)
Fangjun Jiang
2011 年 12 月 15 日
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!