MATLAB: How to copy Real-Time Workshop generated *.c and *.h files to two directories via a TLC file in Real-Time Workshop 7.1 (R2008a)

simulink coder

I am using the LibSetSourceFileOutputDirectory TLC function to generate *.c and *.h files to a directory other than the Real-Time Workshop build directory. I would like to know how I could copy these files to two different directories.

Best Answer

The ability to copy generated files to two directories from the TLC API is not available in Real-Time Workshop 7.1 (R2008a).
To work around the issue, use either of the following techniques:
a) In your TLC file, you can define STF_make_rtw_hook.m and, in the after_tlc hookpoint, copy the generated files to your desired locations.
OR
b) You can use the PostCodeGenCommand parameter to move the source and header files to their desired locations.
For more information on how to control the Simulink code generation and build process please see the documentation section titled "Customizing the Build Process".
You can open the documentation directly by executing the following code in a MATLAB R2008a command window:
web([docroot '/toolbox/rtw/ug/bqobjt8.html#bqobjzq'])
Related Question