How to set the datatype of outport of an S function to Fixed point datatype force fully ?

I am doing some S function releatd things. I need to set my s function output port datatype as a fixed point datatype with some resolution and offset.
Using function "mdlSetDefaultPortDataTypes" I am able to set the output port datatype as direct datatype only(like SS_UINT8). But not able to set some fixed point datatype.
Please suggest How to do that?
Thanks in Advance Rahul VP

 채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 5월 16일
  1. Include fixedpoint.h and fixedpoint.c as described here.
  2. Use ssRegisterDataTypeFxpBinaryPoint to register the desired fixed-point datatype and get its datatype ID.
  3. Set the output datatype by passing the Datatype ID returned in (2) to ssSetOutputPortDataType.
See Writing Fixed-Point S-Functions for a complete reference.

댓글 수: 2

Hi,
If we use function like "ssGetDataTypeFracSlope" releated to fixedpoint then while mexing the s function c file, then you need to Pass an extra argument, -lfixedpoint, to the mex command. For example,
mex('sfun_user_fxp_asr.c','-lfixedpoint')

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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by