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 日

3 投票

  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 件のコメント

NithinRaj
NithinRaj 2012 年 5 月 17 日
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')
Rahul Padmanabhan
Rahul Padmanabhan 2012 年 5 月 17 日
Thanks Kaustuba and Nithin...

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by