MATLAB Application Program Interface Reference Help Desk

mxGetCell

Purpose

Get a cell's contents

C Syntax

Arguments

array_ptr

Pointer to a cell mxArray.

index

The number of elements in the cell mxArray between the first element and the desired one. See mxCalcSingleSubscript for details on calculating an index.

Returns

A pointer to the ith cell mxArray, if successful; otherwise, returns NULL. Causes of failure include

Description

Call mxGetCell to get a pointer to the mxArray held in the indexth element of the cell mxArray.

Examples

Consider a MEX-file named OneTwo that calls mxGetCell to get the (1,2) cell of an input cell mxArray. If cell (1,2) contains a string mxArray, the MEX-file converts its data to C string format.

In MATLAB, create a 2-by-2 cell mxArray named A:

Passing A as an argument to OneTwo

causes OneTwo to convert the contents of cell (1,2) to the C string Marilyn. For an additional example, see mxGetCell.c in the mx subdirectory of the examples directory.

See Also

mxCreateCellArray, mxIsCell, mxSetCell



[ Previous | Help Desk | Next ]