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

조회 수: 5 (최근 30일)
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
grapevine
grapevine 2012년 4월 23일
maybe I found something
ssGetInputPortDataType
http://www.mathworks.nl/help/toolbox/fixpoint/ug/f8041.html
I'll let u know

댓글을 달려면 로그인하십시오.

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by