When using custom data types (Bus, Enum) in S-Function blocks, these custom types need to be registered first before use. The general approach is to
1. Register the data type from S-function parameters (ssRegisterTypeFromParameter).
2. Set the input/output port data type (ssSetInputPortDataType/ssSetOutputPortDataType).
3. Get the data type name using ssGetDataTypeName.
Attached please find an example which demonstrates how to set the input data type of a S-Function block to be of an Bus type, "MyBusObj". The included files are
- busexample.c (source code for the S-Function block).
- busExample1.slx (Simulink model file containing the S-Function block).
- MyBus.mat (MATLAB data file contains the MyBusObj object).
Best Answer