FUNCTION REFERENCE

load

Load variables from a MAT file or a numeric ASCII matrix.

Load variables from a MAT file or a numeric ASCII matrix.

Syntax

load('data.mat')

Syntax

load('data.mat', 'A', 'B')

Syntax

load data.mat A

Syntax

load('data.txt', '-ascii')

Without names it loads every variable in the file. The default file is matlab.mat. Files are found in the Current Folder.

Example

A=5; save('data.mat','A'); clear A; load('data.mat','A'); A   % 5

ASCII files use whitespace or comma delimiters and percent comments. A leading UTF-8 BOM is skipped. Without an output, load creates a variable named for the file. A single output returns the ASCII matrix, or a scalar struct of selected MAT variables, without changing the workspace. Plain structs, including nested fields, are supported in -v6, -v7 and -v7.3 files.

Differences from MATLAB: No wildcards or regular expressions. Object persistence is unsupported; container size and nesting limits apply.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.