External Interfaces 
Using Data Types
You can write MEXfiles, MATfile applications, and engine applications in C that accept any data type supported by MATLAB. In Fortran, only the creation of doubleprecision nbym arrays and strings are supported. You can treat C and Fortran MEXfiles, once compiled, exactly like Mfunctions.
The explore Example
There is an example MEXfile included with MATLAB, called explore
, that identifies the data type of an input variable. The source file for this example is in the <matlab>/extern/examples/mex
directory, where <matlab>
represents the toplevel directory where MATLAB is installed on your system.
Note
In platform independent discussions that refer to directory paths, this book uses the UNIX convention. For example, a general reference to the mex directory is <matlab>/extern/examples/mex .

 Name: prhs[0] Dimensions: 1x1 Class Name: double  (1,1) = 2
explore
accepts any data type. Try using explore
with these examples.
explore([1 2 3 4 5]) explore 1 2 3 4 5 explore({1 2 3 4 5}) explore(int8([1 2 3 4 5])) explore {1 2 3 4 5} explore(sparse(eye(5))) explore(struct('name', 'Joe Jones', 'ext', 7332)) explore(1, 2, 3, 4, 5)
Data Types in MATLAB  Building MEXFiles 
© 19942005 The MathWorks, Inc.