External Interfaces Reference Previous page   Next Page
mxSetFieldByNumber

Set structure array field, given field number and index

C Syntax

Arguments

array_ptr
   Pointer to a structure mxArray. Call mxIsStruct to determine if array_ptr points to a structure mxArray.

index
   The desired element. The first element of an mxArray has an index of 0, the second element has an index of 1, and the last element has an index of N-1, where N is the total number of elements in the structure mxArray. See mxCalcSingleSubscript for details on calculating an index.

field_number
   The position of the field whose value you want to extract. The first field within each element has a field_number of 0, the second field has a field_number of 1, and so on. The last field has a field_number of N-1, where N is the number of fields.

value
   The value you are assigning.

Description

Use mxSetFieldByNumber to assign a value to the specified element of the specified field. mxSetFieldByNumber is almost identical to mxSetField; however, the former takes a field number as its third argument and the latter takes a field name as its third argument.

Calling

is equivalent to calling

Examples

See mxcreatestructarray.c in the mx subdirectory of the examples directory. For an additional example, see phonebook.c in the refbook subdirectory of the examples directory.

See Also

mxCreateStructArray, mxCreateStructMatrix, mxGetField, mxGetFieldByNumber, mxGetFieldNameByNumber, mxGetFieldNumber, mxGetNumberOfFields, mxIsStruct, mxSetField


Previous page  mxSetField mxSetImagData Next page

© 1994-2005 The MathWorks, Inc.