MATLAB Application Program Interface Reference Help Desk

mxIsComplex

Purpose

Inquire if an mxArray is complex

Fortran Syntax

Arguments

pm

Pointer to an mxArray.

Returns

1 if complex, 0 otherwise.

Description

Use mxIsComplex to determine whether or not an imaginary part is allocated for an mxArray. The imaginary pointer pi is 0 if an mxArray is purely real and does not have any imaginary data. If an mxArray is complex, pi points to an array of numbers.

When a MEX-file is called, MATLAB automatically examines all the input (right-hand side) arrays. If any input array is complex, then MATLAB automatically allocates memory to hold imaginary data for all other input arrays. For example, suppose a user passes three input variables (apricot, banana, and carambola) to a MEX-file named Jest:

banana is complex. Therefore, even though array apricot is purely real, MATLAB automatically allocates space (one element) to hold an imaginary value of apricot. MATLAB also automatically allocates space (four elements) to hold the nonexistent imaginary values of carambola.

In other words, MATLAB forces every input array to be real or every input array to be complex.

See Also

mxIsNumeric



[ Previous | Help Desk | Next ]