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

5 visualizaciones (últimos 30 días)
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 comentario
grapevine
grapevine el 23 de Abr. de 2012
maybe I found something
ssGetInputPortDataType
http://www.mathworks.nl/help/toolbox/fixpoint/ug/f8041.html
I'll let u know

Iniciar sesión para comentar.

Respuesta aceptada

Titus Edelhofer
Titus Edelhofer el 23 de Abr. de 2012
Hi Grapevine,
yes, that's right. You will need to register the mdlSetOutputPortDataType function, see matlabroot\simulink\src\sfuntmpl_doc.c
Titus
  2 comentarios
grapevine
grapevine el 23 de Abr. de 2012
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
Titus Edelhofer
Titus Edelhofer el 23 de Abr. de 2012
perfect, I'm glad to hear. You might mark the question as answered if you like.
Titus

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink Coder 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!

Translated by