MATLAB Application Program Interface
  Go to function:
    Search    Help Desk 
mxSetCell    Examples   See Also

Set the value of one cell

C Syntax

Arguments

array_ptr
  Pointer to a cell mxArray.

index
  Index from the beginning of the mxArray. Specify the number of elements between the first cell of the mxArray and the cell you wish to set. The easiest way to calculate index is to call mxCalcSingleSubscript.

value
  The new value of the cell. You can put any kind of mxArray into a cell. In fact, you can even put another cell mxArray into a cell.

Description

Call mxSetCell to put the designated value into a particular cell of a cell mxArray. Use mxSetCell to assign new values to unpopulated cells or to overwrite the value of an existing cell.

If the specified cell is already occupied, then mxSetCell assigns the new value. However, the old cell value remains in memory until you call mxDestroyArray.

Note: Inputs to a MEX-file are constant read-only mxArrays and should not be modified. Using mxSetCell* or mxSetField* to modify the cells or fields of an argument passed from MATLAB will cause unpredictable results.

Examples

For an example of using mxSetCell to populate cells in a freshly created cell mxArray, see mxCreateCharArray.

Consider a function that calls mxSetCell to change the value already held in the first cell element.

For an additional example, see mxsetcell.c in the mx subdirectory of the examples directory.

See Also

mxCreateCellArray, mxCreateCellMatrix, mxGetCell, mxIsCell



[ Previous | Help Desk | Next ]