Target Language Compiler    

Structure of Record Files

Real-Time Workshop compiles models into a structured form called a record file, referred to as model.rtw. Such compiled model files are similar in syntax and organization to source model (model.mdl) files, in that they contain a series of (usually hierarchically nested) records of the form

Item names are alphabetic. Item values can be strings or numbers. Numeric values can be scalars, vectors, or matrices. Curly braces set off the contents of each record, which may contain one or more items, delimited by space, tab, and/or return characters.

In a model.rtw file, the top-level (first) record's name is CompiledModel. Each block is represented by a subrecord within it, identified by the block's name. The TLC, however, can parse any well-formed record file, as this exercise demonstrates.

The following listing is a valid record file that the TLC can parse, although not one for which it can generate code. Comments are indicated by a pound sign (#):

As long as the programmer knows the names of records and fields, and their expected contents, he or she can compose TLC statements to read, parse, and manipulate record file data.


  Reading Record Files with TLC Interpreting Records