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

2 views (last 30 days)
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

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 16 May 2012
  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 Comments
NithinRaj
NithinRaj on 17 May 2012
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')

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!