Main Content

Configure TLC

Set Command-Line Arguments

You can enter TLC command-line arguments from the MATLAB® command line using the set_param command, the model parameter TLCOptions, and the TLC option -a. For example, to enter the TLC command-line string -amyConfigVariable=1, use the following MATLAB command:

set_param(modelName,'TLCOptions','-amyConfigVariable=1');

Using -amyConfigVariable=1 is equivalent to coding the following in your target file:

%assign myConfigVariable = 1

Alternatively, you can configure the TLC code generation process by using the -a option on the TLC command line. That is, you must give the TLC command interactively.

You can repeatedly use the -a option.

For an example of how this process works, consider the following TLC code fragment:

%if !EXISTS(myConfigVariable)
  %assign myConfigVariable = 0 
%endif
  %if (myConfigVariable == 1)
      code fragment 1
  %else      
      code fragment 2
  %endif

If you specify-amyConfigVariable=1 in the command line, code fragment 1 is generated; otherwise code fragment 2 is generated. The if block starting with

%if !EXISTS(myConfigVariable)

serves to set the default value of myConfigVariable to 0, so that TLC does not generate an error if you forget to add -amyConfigVariable to the command line.

If you use the -a option to input a string variable, the variable must be enclosed in double quotation marks:

-aMyStringVariable="hello"

However, if the string contains white space, enclose the string within apostrophes and double quotation marks:

-aMyStringVariable="'hello world'"

Do this if apostrophes exist within the string, whether or not white space is included, and the apostrophes must be escaped (doubled):

-aMyStringVariable="'can''t'"

Configure for TLC Debugging

To configure TLC for debugging via the Configuration Parameters dialog box, search for the option Start TLC debugger when generating code. To activate TLC debugger, select Start TLC debugger when generating code. For more information, see Using the TLC Debugger and the debugging topics in Target Language Compiler.

Related Topics