Target Language Compiler    

Using Library Functions to Access model.rtw Contents

There are several library functions that provide access to block inputs, outputs, parameters, sample times, and other information. It is recommended that you use these library functions to access many of the parameter name/parameter values pairs in the block record as apposed to accessing the parameter name/parameter values pairs directly from your block TLC code.

See TLC Function Library Reference, for a list of the commonly used library functions.

The library functions simplify block TLC code and provide support for loop rolling, data types, and complex data. The functions also provide a layer to protect against changes that may occur to the contents of the model.rtw file.

Caution Against Directly Accessing Record Fields

When functions in the block target file are called, they are passed the block and system records for this instance as arguments. The first argument, block, is in scope, which means that variable names inside this instances Block record are accessible by name. For example,

Block target files could generate code for a given block by directly using the fields in the Block record for the block. This process is not recommended for two reasons:


  Object Information in the model.rtw File Exception to Using the Library Functions