table of contents
- unstable 1.6.0-1
| MAT_VARSETSTRUCTFIELDBYINDEX(3) | Library Functions Manual | MAT_VARSETSTRUCTFIELDBYINDEX(3) |
NAME¶
Mat_VarSetStructFieldByIndex —
Sets a field in a structure array by index.
SYNOPSIS¶
#include
<matio.h>
matvar_t *
Mat_VarSetStructFieldByIndex(matvar_t
*matvar, size_t field_index,
size_t index, matvar_t
*field);
DESCRIPTION¶
The
Mat_VarSetStructFieldByIndex()
function assigns field to the structure field at
0-relative field index field_index for the structure
element at linear index in
matvar. The function requires
matvar to be a structure variable created by
Mat_VarCreateStruct()
or
Mat_VarCreateStruct2().
When a field is assigned successfully, the field variable name is updated to
match the structure field name.
RETURN VALUES¶
On success, the previous field stored at the requested structure element and field position is returned. If no previous field was set, or if matvar is not a valid structure variable, NULL is returned.
EXAMPLES¶
This example assigns a field in a structure array by index.
matvar_t *old_field;
old_field = Mat_VarSetStructFieldByIndex(matvar, 1, 0, field2);
if ( old_field != NULL )
Mat_VarFree(old_field);
SEE ALSO¶
Mat_VarCreateStruct(3), Mat_VarCreateStruct2(3), Mat_VarAddStructField(3), Mat_VarSetStructFieldByName(3)
| April 23, 2026 | Nixpkgs |