Skip to Main Content Skip to Search
Product Documentation

Creating MEX-Files

Introduction

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.

MEX-Files on UNIX

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')

MEX-Files on Windows

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:

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:

  


Related Products & Applications

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