---
name: "Mat_VarGetStructsLinear"
section: "3"
platform: "linux"
package: "libmatio"
version: "1.5.30-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Mat_VarGetStructsLinear"
---

# Mat\_VarGetStructsLinear(3)

Linearly index a structure variable

## NAME

**Mat\_VarGetStructsLinear** – Linearly index a structure variable

## SYNOPSIS

**#include \<matio.h\>**

*matvar\_t* *\**\

**Mat\_VarGetStructsLinear**(*const matvar\_t \*matvar*, *int start*, *int stride*, *int edge*, *int copy\_fields*);

## DESCRIPTION

The **Mat\_VarGetStructsLinear**() function selects a subarray from a structure array *matvar.* Each of the elements in the subarray contains all of the fields of the structure. The indexing starts at the *start* element in the array (0 being the first element), and reads every *stride* values (1 being every element, 2 every other element, etc.). The total number of elements in the subarray is specified as *edge.* The original array must have at least *start+(stride-1)\*edge+1* elements. The *copy\_fields* option specifies whether the fields of the original structure are copied for the new subarray. If set to 0, the returned structure array's fields have the same pointer as the original array, and the data field of the subarray structure. The subarray is marked with the conserve memory flag indicating that the fields should not be free'd. They are free'd when the original structure is free'd.

## RETURN VALUES

A subarray of the original structure array, or NULL if there is an error.

## SEE ALSO

[Mat\_VarGetStructs(3)](/Mat_VarGetStructs/3.md)
