Main Content

mxIsClass (C)

Determine whether mxArray is object of specified class

C Syntax

#include "matrix.h"
bool mxIsClass(const mxArray *pm, const char *classname);

Returns

Logical 1 (true) if pm points to an array having category classname, and logical 0 (false) otherwise.

Description

Each mxArray is tagged as being a certain type. mxIsClass returns logical 1 (true) if the mxArray is of the specified type. Otherwise, the function returns logical 0 (false).

MATLAB® does not check if the class is derived from a base class.

In C:

mxIsClass(pm, "double");

is equivalent to calling either of these forms:

mxIsDouble(pm);
strcmp(mxGetClassName(pm), "double");

It is more efficient to use the mxIsDouble form.

Input Arguments

expand all

Pointer to an mxArray array, specified as const mxArray*.

Array category to test, specified as const char*. Use one of these predefined constants. Do not specify classname as an integer identifier.

Value of classname

Corresponding Class

cell

mxCELL_CLASS

char

mxCHAR_CLASS

double

mxDOUBLE_CLASS

function_handle

mxFUNCTION_CLASS

int8

mxINT8_CLASS

int16

mxINT16_CLASS

int32

mxINT32_CLASS

int64

mxINT64_CLASS

logical

mxLOGICAL_CLASS

single

mxSINGLE_CLASS

struct

mxSTRUCT_CLASS

uint8

mxUINT8_CLASS

uint16

mxUINT16_CLASS

uint32

mxUINT32_CLASS

uint64

mxUINT64_CLASS

<class_name>, which represents the name of a specific MATLAB custom object. You can also specify one of your own class names.

<class_id>

unknown

mxUNKNOWN_CLASS

Examples

See these examples in matlabroot/extern/examples/mx:

Introduced before R2006a