Qu

read_mat

Builtin index · File I/O

result = read_mat(path)

Input: path · Output: result

What it is

Reads a MATLAB .mat file (via the matfile crate) without needing a MATLAB installation. path (string) is the file.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = read_mat(path)
path stringnot documented yet
result scalar, vector, or matrix
Returns a record with one field per saved variable, named after the variable, each holding that variable's data (a scalar, vector, or matrix depending on what was saved).

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

vars = read_mat("measurements.mat")
print(vars.temperature)                  # [20.5, 21, 19.8]

not run by the build — this one needs something the repository cannot supply · from file-io

How it works

read_mat(path) -- a MATLAB Level 5 .mat file, as a record of its variables. Structs become nested records, cell arrays become lists, numeric arrays become vectors or matrices. Written because a stored-results file is where real analysis starts: the "Why Crest Factor Matters" port could reproduce every number it computed itself and still not draw four of the paper's five figures, because those read a .mat. The alternative -- converting to CSV with Python first -- makes the port depend on the language it is supposed to replace.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.