Target Language Compiler    

Using Scopes in the model.rtw File

Accessing Values

Each record creates a new scope. The model.rtw file uses curly braces { and } to open and close records (or scopes). Using scopes, you can access any value within the model.rtw file.

The scope in this example begins with CompiledModel. Use periods (.) to access values within particular scopes. The format of model.rtw is

For example, to access Name within CompiledModel, you would use

Multiple records of the same name form a list where the index of the first record starts at 0. To access the above S-function block record, you would use

To access the name field of this block, you would use

To simplify this process, you can use the %with directive, which changes the current scope. For example:

blockName will have the value "<S3>/S-Function".

When inlining S-function blocks, your S-function block record is scoped as though the above %with directive was done. In an inlined .tlc file, you should access fields without a fully qualified path.

The following code shows a more detailed scoping example where the Block record has several parameter-value pairs (Type, Name, Identifier, and so on), and three subrecords, each called Parameter. Block is a subrecord of System, which is a subrecord of CompiledModel.

For a full description of the model.rtw file, see model.rtw. Note that the parameter names in this file changes from release to release.


  Model.rtw File Overview Object Information in the model.rtw File