matfile — Create a MAT-file object for whole-variable reads and writes.

matfile(filename) returns a matlab.io.MatFile compatibility object. RunMat supports m.Properties, whole-variable dot reads such as m.A, and whole-variable dot assignment when the object is constructed with 'Writable', true.

Syntax

matfile(filename)

Options

  • Writable accepts a scalar logical or numeric value. When false or omitted, dot assignment through the object is rejected.
  • m.Properties returns a struct containing Source and Writable.
  • Dot reads load a complete variable from the MAT-file, preserving the existing load builtin's Level-5 MAT-file type support.

GPU memory and residency

matfile is host file I/O. GPU-resident assignment values are gathered before MAT-file serialization.

Examples

Read a whole variable

m = matfile('data.mat');
A = m.A;

Expected output:

A contains the variable loaded from data.mat.

Write whole variables

m = matfile('data.mat', 'Writable', true);
m.A = rand(3);
m.flag = true;

Expected output:

The MAT-file is rewritten with updated whole variables.

Using matfile with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how matfile changes the result.

Run a small matfile example, explain the result, then change one input and compare the output.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.