table of contents
- unstable 1.6.0-1
| MAT_VARSETSTRUCTFIELDBYNAME(3) | Library Functions Manual | MAT_VARSETSTRUCTFIELDBYNAME(3) |
NAME¶
Mat_VarSetStructFieldByName —
Sets a field in a structure array.
SYNOPSIS¶
#include
<matio.h>
matvar_t *
Mat_VarSetStructFieldByName(matvar_t
*matvar, const char *field_name,
size_t index, matvar_t
*field);
DESCRIPTION¶
The
Mat_VarSetStructFieldByName()
function assigns field to the structure field named
field_name 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 fields in a structure array by name and by index.
matvar_t *old_field;
old_field = Mat_VarSetStructFieldByName(matvar, "field1", 0, field1);
if ( old_field != NULL )
Mat_VarFree(old_field);
SEE ALSO¶
Mat_VarCreateStruct(3), Mat_VarCreateStruct2(3), Mat_VarAddStructField(3), Mat_VarSetStructFieldByIndex(3)
| April 23, 2026 | Nixpkgs |