MATLAB Application Program Interface Reference Help Desk

mxIsComplex

Purpose

True if data is complex

C Syntax

Returns

true if array_ptr is a numeric array containing complex data; otherwise, returns false. If array_ptr points to a cell array or a structure array, then mxIsComplex returns false.

Description

Use mxIsComplex to determine whether or not an imaginary part is allocated for an mxArray. The imaginary pointer pi is NULL 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.

Example

See mxIsComplex.c in the mx subdirectory of the examples directory.

See Also

mxIsNumeric



[ Previous | Help Desk | Next ]