MATLAB Function Reference
  Go to function:
    Search    Help Desk 
load    See Also

Retrieve variables from disk

Syntax

Description

The load and save commands retrieve and store MATLAB variables on disk.

load by itself, loads all the variables saved in the file 'matlab.mat'.

load filename retrieves the variables from 'filename.mat' given a full pathname or a MATLABPATH relative partial pathname .

load (filename) loads a file whose name is stored in filename. The statements:

retrieve the variables from the binary file 'filename.mat'.

load filename.ext reads ASCII files that contain rows of space separated values. The resulting data is placed into an variable with the same name as the file (without the extension). ASCII files may contain MATLAB comments (lines that begin with %).

load filename -ascii or load filename -mat can be used to force load to treat the file as either an ASCII file or a MAT file.

S = load(...) returns the contents of a MAT-file as a structure instead of directly loading the file into the workspace. The field names in S match the names of the variables that were retrieved. When the file is ASCII, S is a double-precision array.

Remarks

MAT-files are double-precision binary MATLAB format files created by the save command and readable by the load command. They can be created on one machine and later read by MATLAB on another machine with a different floating-point format, retaining as much accuracy and range as the disparate formats allow. They can also be manipulated by other programs, external to MATLAB.

The Application Program Interface Libraries contain C and Fortran callable routines to read and write MAT-files from external programs.

See Also

fprintf     Write formatted data to file

fscanf      Read formatted data from file

save        Save workspace variables on disk

spconvert   Import matrix from sparse matrix external format

See also partialpath.



[ Previous | Help Desk | Next ]