I want to learn how to generate C code from an already existing Simulink model. I would appreciate all tips on where I can find step by step information on how to do this. I couldn't find information (which I understand) in the MATLAB help.
Thanks in advance!
/Emma
Emma,
First, you need to make sure that you model is set up with 3 basic parts: an input--subsystem--output (with the subsystem being everything that you want to generate code for). Next, go to simulation--configuration parameters-Real Time workshop tab. Look at the target selection section and click browse next to system target file. Select the first ERT option then click ok. Select your generated language (I used C++ for my code so I am not sure the same process works for different languages) and make sure that the generate code only box is checked at the bottom. click ok.
In the MATLAB command prompt type
>>RTW.configSubsystemBuild('NameOfModel/Subsystem')
A GUI will pop up. Under function specification select model specific c prototypes and then click get defualt configuration. Click validate at the bottom and wait for success before hitting ok.
The last step is to right-click on the subsystem go to Real time workshop-build subsystem. Another GUI will pop up click build and you should have c code.
Hope this helps,
Meagan