==Sfunction Input with a Bus input==
I have had this error message on connection a bus to a Sfunction. The Inport port was 'DYNAMICALLY_TYPED'. That's good to connect simple numeric types maybe with arrays (using ssSetInputPortWidth(..., DYNAMICALLY_SIZED). But it is not proper to connect a bus.
To connect a bus to an inport port of a S-function, the type have to be set with the correct bus type. That can be given with a String parameter. Write:
char type[256];
mxGetString(ssGetSFcnParam(simstruct, 1), type, sizeof(type));
if (type[0] != 0){ //not an empty param
#if defined(MATLAB_MEX_FILE)
if (ssGetSimMode(simstruct) != SS_SIMMODE_SIZES_CALL_ONLY) {
DTypeId dataTypeIdReg;
ssRegisterTypeFromNamedObject(simstruct, type, &dataTypeIdReg);
if (dataTypeIdReg == INVALID_DTYPE_ID) return;
ssSetInputPortDataType(simstruct, 1, dataTypeIdReg);
}
#endif
In the moment I don't know whether '#if defined(MATLAB_MEX_FILE)' is necessary - get experience.
hartmut.schorrig@vishia.org www.vishia.org