User`s guide

Using BlockIOSignals to Obtain Block Outputs
5-7
You must then write code that walks through the rtBIOSignals array and
chooses the signals to be monitored based on the
blockName and signalName or
portNumber. How the signals are monitored is up to you. For example, you
could collect the signals at every time step or just sample them asynchronously
by a separate, lower priority task.
For example, the Tornado source file,
rt_main.c, defines the following function
that selectively installs signals from the
BlockIOSignals array into the
StethoScope Graphical Monitoring/Data Analysis Tool by calling
ScopeInstallSignal. The signals are then collected in the main simulation
task by calling
ScopeCollectSignals.
The code below is an example routine that installs signals from the
BlockIOSignals array:
static int_T rtInstallRemoveSignals(SimStruct *S,
char_T *installStr, int_T fullNames, int_T install)
{
uint_T i, w;
char_T *blockName;
char_T name[1024];
extern BlockIOSignals rtBIOSignals[];
int_T ret = -1;
if (installStr == NULL) {
return -1;
}
i = 0;
while(rtBIOSignals[i].blockName != NULL) {
BlockIOSignals *blockInfo = &rtBIOSignals[i++];
if (fullNames) {
blockName = blockInfo->blockName;
} else {
blockName = strrchr(blockInfo->blockName, '/');
if (blockName == NULL) {
blockName = blockInfo->blockName;
} else {
blockName++;
}
}
if ((*installStr) == '*') {
} else if (strcmp("[A-Z]*", installStr) == 0) {
if (!isupper(*blockName)) {
continue;
}
} else {
if (strncmp(blockName, installStr, strlen(installStr)) != 0) {