views:

684

answers:

3

I want to use a Simulink mdl to generate C files in an automated fashion. I am currently trying to use an m-script and a dos command shell, but I am having issues with a "do you want to save" dialog hanging the m-script. By experimentation I know that the mdl is being modified when the "set_param" line is run (i.e. no "save" dialog issue if the set_param call is removed), but I need to do some setup of the mdl prior to generating code.

m-script:

rtwdemo_counter
set_param(gcs,'SystemTargetFile','ert.tlc')
rtwbuild(gcs)
exit

dos

matlab -r samplebuild -nosplash -nodesktop

Matlab 7.7.0,471 on Windows XP

My ultimate goal is to auto-generate the code on a continuous integration server (CruiseControl) and I feel there must be a more robust way of accomplishing this with the matlab tool-chain.

A: 

can you do something like:

matlab -r samplebuild -nosplash -nodesktop < yes

?

Actually I know you can do it, just not sure it will work... ;)

Jeffrey Fredrick
+3  A: 

Use the following command to force the model to be closed without saving:

 close_system(gcs, false);

E.g.

 rtwdemo_counter
 set_param(gcs,'SystemTargetFile','ert.tlc')
 rtwbuild(gcs)
 close_system(gcs, false);
 exit
A: 

Hi, I think you should take a look at my post where I describe continuous integration with Matlab using Team Foundation.

Mr B