External Interfaces Previous page   Next Page

Handling Complex Data

Complex data from MATLAB is separated into real and imaginary parts. The MATLAB API provides two functions, mxGetPr and mxGetPi, that return pointers (of type double *) to the real and imaginary parts of your data.

This example takes two complex row vectors and convolves them.

Below is the gateway routine that calls this complex convolution.

Entering these numbers at the MATLAB prompt

and invoking the new MEX-file

results in

which agrees with the results that the built-in MATLAB function conv.m produces.


Previous page  Passing Structures and Cell Arrays Handling 8-,16-, and 32-Bit Data Next page

© 1994-2005 The MathWorks, Inc.