load
Reads the content of a MAT file.
Syntax
R = load(filename)
R = load(filename, variable)
R = load(filename, type)
load filename
Inputs
- filename
- Path and name of the MAT file to load.
- variable
- List of the variables to load, separated by a comma.
- type
- Used to indicate the file to load is ASCII.
Outputs
- R
- Struct with values read from the file.
Example
% create a matrix
M = [ 1923.71288 4023.03575 9768.82832 9195.83701 104.13143 4261.35201 ];
% create a string
st='hello';
% save to file
save('file.mat')
%simple load
load('file.mat')
%load only the matrix M
load('file.mat','M')
% load and return content in a struct
R=load('file.mat')
struct [
M: [Matrix] 1 x 6
1923.71288 4023.03575 9768.82832 9195.83701 104.13143 4261.35201
st: hello
]
% foo.dat is an ASCII file with 2 lines and 3 columns (either separated by spaces or commas)
R=load('foo.dat','-ascii')
R = [Matrix] 2 x 3
1923.71288 4023.03575 9768.82832
9195.83701 104.13143 4261.35201