---
name: "Mat_VarFree"
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_VarFree"
---

# Mat\_VarFree(3)

Frees a MAT variable structure.

## NAME

**Mat\_VarFree** – Frees a MAT variable structure.

## SYNOPSIS

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

*void*\

**Mat\_VarFree**(*matvar\_t \*matvar*);

## DESCRIPTION

The **Mat\_VarFree**() function free's the memory used by a MAT variable structure. If the variable was not created with the MAT\_F\_DONT\_COPY\_DATA flag, the variable data is also free'd.

## SEE ALSO

[Mat\_VarCreate(3)](/Mat_VarCreate/3.md), [Mat\_VarCreateStruct(3)](/Mat_VarCreateStruct/3.md)
