matfile Save and load parts of variables in MAT-files.
MATOBJ = matfile(FILENAME) constructs an object that can load or save
parts of variables in MAT-file FILENAME. MATLAB does not load any data
from the file into memory when creating the object. FILENAME can
include a full or partial path, otherwise matfile searches along the
MATLAB path. If the file does not exist, matfile creates the file on
the first assignment to a variable.
MATOBJ = matfile(FILENAME,’Writable’,ISWRITABLE) enables or disables
write access to the file. ISWRITABLE is logical TRUE (1) or FALSE (0).
By default, matfile opens existing files with read-only access, but
creates new MAT-files with write access.
Access variables in MAT-file FILENAME as properties of MATOBJ, with dot
notation similar to accessing fields of structs. The syntax for loading
part of variable VARNAME into variable SMALLERVAR is
SMALLERVAR = MATOBJ.VARNAME(INDICES)
Similarly, the syntax for saving NEWDATA into variable VARNAME is
MATOBJ.VARNAME(INDICES) = NEWDATA
Specify part of a variable by defining indices for every dimension.
Indices can be a single value, an equally spaced range of increasing
values, or a colon (:), such as:
MATOBJ.VARNAME(100:500, 200:600)
MATOBJ.VARNAME(:, 501:1000)
MATOBJ.VARNAME(1:2:1000, 80)