User`s guide

Using BlockIOSignals to Obtain Block Outputs
5-9
Below is an excerpt from an example routine that collects signals taken from
the main simulation loop:
/*******************************************
* Step the model for the base sample time *
*******************************************/
MdlOutputs(FIRST_TID);
#ifdef MAT_FILE
if (rt_UpdateTXYLogVars(S) != NULL) {
fprintf(stderr,"rt_UpdateTXYLogVars() failed\n");
return(1);
}
#endif
#ifdef STETHOSCOPE
ScopeCollectSignals(0);
#endif
MdlUpdate(FIRST_TID);
<code continues ...>
The Real-Time Workshop provides a mechanism that allows your application
program to monitor block outputs during program execution.
All block output data is written to the
SimStruct at each step through the
model code. However, to access the output of any given block in the
SimStruct,
you must know the index into the
BlockIO vector where the data is stored, as
well as how many output ports the block has and the width of each output. All
of this information is contained in the
ModelBlockInfo data structure.
The
ModelBlockInfo data structure is created by the generated code only if you
define the flag
USE_MDLBLOCKINFO when you build your program. Otherwise,
ModelBlockInfo is not created.
Note that, depending on the size of your model,
ModelBlockInfo can consume
a considerable amount of memory.