---
name: "Mat_VarGetNumberOfFields"
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_VarGetNumberOfFields"
---

# Mat\_VarGetNumberOfFields(3)

Gets the number of fields for a structure variable.

## NAME

**Mat\_VarGetNumberOfFields** – Gets the number of fields for a structure variable.

## SYNOPSIS

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

*unsigned*\

**Mat\_VarGetNumberOfFields**(*const matvar\_t \*matvar*);

## DESCRIPTION

The **Mat\_VarGetNumberOfFields**() function returns the number of fields for the structure variable *matvar.*

## RETURN VALUES

The number of fields will be returned on success, and 0 otherwise. Note also that a structure can validly contain 0 fields.

## SEE ALSO

[Mat\_VarGetStructFieldnames(3)](/Mat_VarGetStructFieldnames/3.md)
