Using external libraries with MATLAB, MEX files
Using external libraries with MATLAB, MEX files
Using external libraries with MATLAB, MEX files
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Examples of C <strong>MEX</strong>-Files:<br />
Passing a Scalar<br />
• Computational module<br />
#include <br />
void timestwo(double y[], double x[])<br />
{<br />
y[0] = 2.0*x[0];<br />
return;<br />
}<br />
• <strong>MEX</strong>-file<br />
#include "mex.h"<br />
void timestwo(double y[], double x[])<br />
{<br />
y[0] = 2.0*x[0];<br />
}<br />
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,<br />
const mxArray *prhs[])<br />
{<br />
double *x, *y;<br />
int mrows, ncols;