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

5 views (last 30 days)
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 Comment
grapevine
grapevine on 23 Apr 2012
maybe I found something
ssGetInputPortDataType
http://www.mathworks.nl/help/toolbox/fixpoint/ug/f8041.html
I'll let u know

Sign in to comment.

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!