| Writing S-Functions | ![]() |
S-Function RTWdata for Generating Code with Real-Time Workshop
There is a property of blocks called RTWdata, which can be used by the Target Language Compiler when inlining an S-function. RTWdata is a structure of strings that you can attach to a block. It is saved with the model and placed in the model.rtw file when generating code. For example, this set of MATLAB commands,
mydata.field1 = 'information for field1'; mydata.field2 = 'information for field2'; set_param(gcb,'RTWdata',mydata) get_param(gcb,'RTWdata')
ans =
field1: 'information for field1'
field2: 'information for field2'
Inside the model.rtw for the associated S-function block is this information.
Block {
Type "S-Function"
RTWdata {
field1 "information for field1"
field2 "information for field2"
}
| Fully Inlined S-Function with the mdlRTW Routine | The Direct-Index Lookup Table Algorithm | ![]() |