Mask s-function with datatype selector and register datatype in s-function
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I would like to mask an s-function with a datatype selector:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/885740/image.png)
The datatype can to be selected be a standard matlab build in datatype, a bus or an enumeration.
How would I be able to retrieve the datatypeID of the selected datatype in the mask in the s-function and register it, so I can retrieve its size with ssGetDataTypeSize()?
Thank you in advance!
Kind regards,
Brecht
2 comentarios
Benjamin Thompson
el 8 de Feb. de 2022
Why does the mask care about the data type? The S-Function can get the data type by calling ssGetInputPortDataType, and get the size, and if you like that data type, you proceed. If you do not, call ssPrintf or ssSetErrorStatus.
Respuestas (1)
Benjamin Thompson
el 28 de Feb. de 2022
Busses are treated a lot differently as Simulink marshals data to pass to or from an S-Function. So what you are describing cannot extend to busses. See the Busses section in the article "Configure C/C++ S-Function Features". For the other basic data types you can have the S-Function call ssGetInputPortDataType or ssGetOutputPortDatatype and use the result to determine how to handle the pointers you get when calling ssGetInputPortSignal or ssGetOutputPortSignal.
0 comentarios
Ver también
Categorías
Más información sobre Configure Block Features for MATLAB S-Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!