Mask s-function with datatype selector and register datatype in s-function
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I would like to mask an s-function with a datatype selector:
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 Commenti
Benjamin Thompson
il 8 Feb 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.
Risposte (1)
Benjamin Thompson
il 28 Feb 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 Commenti
Vedere anche
Categorie
Scopri di più su Configure Block Features for MATLAB S-Functions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!