Documentation Center

  • Trial Software
  • Product Updates

ssIsDataTypeABus

Determine whether a data type identifier represents a bus signal

Syntax

boolean_T ssIsDataTypeABus(S, int_T typeID)

Arguments

S

SimStruct that represents an S-Function block

typeID

The data type identifier that represents a signal

Returns

boolean_T

Description

Use to determine whether the data type identifier for a signal represents a bus signal and whether a bus element of another bus signal is itself a bus signal. To obtain the data type identifier for the bus element, use ssGetBusElementDataType.

Bus S-function Usage Guidelines

Use this S-function in simulations. You cannot use this S-function for code generation.

This S-function does not support bus elements that have any of the following characteristics:

  • Variable dimensions

  • Frames

  • Enumerated (enum) data types

To use this S-function and other bus-related S-functions, before you run the simulation, execute the following MATLAB® command:

set_param(block_handle, 'EnableBusSupport', 'on')

To automate setting the EnableBusSupport parameter, use one of the following approaches:

  • Add the command to the model initialization callback.

  • Mask the S-Function block and add the command to the mask initialization callback

Languages

C, C++

Example

static void mdlOutputs(SimStruct *S, int_T tid)
 {
    DTypeId    dType    = ssGetOutputPortDataType(S, 0);
    const void *u       = ssGetInputPortSignal(S, 0);
    int        numElems = ssGetNumBusElements(S, dType);
    int        i;
    
    for(i=0; i<numElems; i++) {
        
        if (ssIsDataTypeABus(S, elemType)) {
            /* Sub-bus element */
            ...
        }
     }
  }
Was this topic helpful?