how to inherit the data type of the inputs in a C Mex Sfunction

Hello everyone,
I was wondering if it's possible to write a s-function in C without specifying the data type of the input variables. I need it because I have to write a block which is able to process any types of data
thanks 4 reading
cheers

1 Kommentar

maybe I found something
ssGetInputPortDataType
http://www.mathworks.nl/help/toolbox/fixpoint/ug/f8041.html
I'll let u know

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Titus Edelhofer
Titus Edelhofer am 23 Apr. 2012

1 Stimme

Hi Grapevine,
yes, that's right. You will need to register the mdlSetOutputPortDataType function, see matlabroot\simulink\src\sfuntmpl_doc.c
Titus

2 Kommentare

great!!! it works!
thanks 4 the help
I just modifies
static void mdlInitializeSizes(SimStruct *S)
{
......
ssSetInputPortDataType(S, 0, DYNAMICALLY_TYPED);
......
}
static void mdlSetInputPortDataType(SimStruct *S, int portIndex, DTypeId dataTypeIdInput)
{
ssSetInputPortDataType( S, portIndex, dataTypeIdInput);
}
and it works fine.
thanks a lot
perfect, I'm glad to hear. You might mark the question as answered if you like.
Titus

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by