MEX Functions and Files

Ben Trumbore, Brandon Barker, Nate Woody (original)
Cornell Center for Advanced Computing

Revisions: 8/2023, 8/2020, 3/2011 (original)

This topic covers the basics of writing MEX functions that are written in other programming languages and which, after compiling, can be incorporated into your MATLAB programs. Several examples are provided and the APIs that allow you to code in different languages are discussed. The topic closes with an exercise that explores a more complicated MEX function.

Objectives

After you complete this segment, you should be able to:

  • Describe the four standard parameters of a MEX function.
  • Write and compile a simple MEX function.
  • Run a compiled MEX function.
  • Describe the various APIs that can be used to create MEX functions in different programming languages.
Prerequisites

Before reading this topic, you should:

 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement