| Contents | Index |
void ssSetBusInputAsStruct(SimStruct *S, int_T portNum, boolean_T val)
SimStruct that represents an S-Function block
The zero-based index of the input port of the S-function block
True, if the input signal is a virtual bus and should be converted to a nonvirtual bus; false otherwise
None
Use to instruct Simulink to convert the virtual bus that is connected to the block from a virtual to a nonvirtual bus. Simulink inserts a Signal Conversion block (with the Output block parameter set to Nonvirtual bus) at the input of the S-function, if necessary. If the incoming signal is already a nonvirtual bus, this method takes no action.
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
C, C++
static void mdlInitializeSizes(SimStruct *S)
{
char* busName;
/* Bus object name is passed in as a parameter */
ssGetSFcnParamName(S, 0, &busName);
ssSetBusOutputObjectName(S, 0, busName);
/* Output nonvirtual bus */
ssSetBusInputAsStruct(S, 0, true);
ssSetBusOutputAsStruct(S, 0, true);
…
}
ssSetBusOutputObjectName, ssSetBusOutputAsStruct

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |