MATLAB: Automating Simulink Code Generation from DOS Command Window

automationcodercompilersimulink

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

Best Answer

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.