| Contents | Index |
| On this page… |
|---|
In addition to including fixedpoint.c and fixedpoint.h (see Structure of the S-Function), the sections that follow describe additional steps you need to take to create a MEX-file for your user-written fixed-point S-function.
For general information on creating MEX-files, refer to Writing Wrapper S-Functions in the Simulink Coder documentation.
On UNIX® systems, to create a MEX-file for a user-written fixed-point S-function, you need to pass an extra argument, -lfixedpoint, to the mex command. For example,
mex('sfun_user_fxp_asr.c','-lfixedpoint')On Windows® systems, to create a MEX-file for a user-written fixed-point S-function, you need to pass an extra argument to the mex command that identifies the appropriate version of libfixedpoint.lib. The version of libfixedpoint.lib that you use depends on the compiler that you specify when mex -setup is run. The possible versions, which are installed with Simulink software, are as follows:
extern\lib\win32\lcc\libfixedpoint.lib
extern\lib\win32\microsoft\libfixedpoint.lib
extern\lib\win32\watcom\libfixedpoint.lib
For example, if Version 6.0 of the Microsoft® Visual C++® software is the compiler that the mex command is configured to use,
mex('sfun_user_fxp_asr.c',[matlabroot,'\extern\lib\win32\...
microsoft\libfixedpoint.lib'])If your C compiler is not listed, consider the following options:
Use the LCC freeware compiler. LCC is normally installed when the MATLAB software is installed. When you run mex -setup on a Windows system, LCC should be listed as an option.
Your compiler may provide tools for translating one of the libfixedpoint.lib files or extern/include/libfixedpoint.def to the required format.
![]() | Overflow Handling and Rounding Methods | Fixed-Point S-Function Examples | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |