| Target Language Compiler | ![]() |
Invoking Code Generation
Typically, rtwgen and TLC (as seen in the first section) are called directly from the Real-Time Workshop build procedure. This avoids problems that may arise due to command arguments changing from release to release. Thus you normally invoke rtwgen and tlc when you click the Build (or Generate code) button on the Real-Time Workshop dialog box. Sometimes, however, circumstances may require you to execute rtwgen and tlc directly from the MATLAB prompt.
To generate the model.rtw file from the MATLAB prompt, it usually suffices to type
However, you may want to specify a build directory in which to place the output file. You exercise this and other options using keyword, value syntax.
You may specify other options to rtwgen, such as whether or not identifiers should have case sensitivity, and reserved keywords. For more details, type
The tlc Command
Once the .rtw file generates, to run the Target Language Compiler on this file, type
This generates output as directed by file.tlc. Options to TLC include
-Ipath, which specifies paths to look for files included by the %<include> directive (do not insert a space after -I)
-r model.rtw, the compiled model file from which to generate code (note required space character before the argument)
-aident=expression, which assigns a value to the TLC identifier ident. Note that there is no space after -a. This is discussed in Configuring TLC and explored in the TLC tutorial in Processing model.rtw Files with TLC Scripts.
| A Basic Example | Configuring TLC | ![]() |