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 commentaire

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

Connectez-vous pour commenter.

 Réponse acceptée

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

2 commentaires

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

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by