save
Save variables in the MAT file, filename.
Syntax
save(filename, variables)
save(filename, variables, format)
save(filename)
save(filename, format)
Inputs
- filename
- Path and name of the MAT file to save.
- variable
- Optional list of the variables to save, separated by a comma.
- format
- Specifies the format of the file to save. If omitted, format 5 is assumed.
Examples
Save data to a .mat file using save
function:
% create some string
st='hello';
% create a matrix
M = [ 1923.71288 4023.03575 9768.82832 9195.83701 104.13143 4261.35201 ];
% save to file
save('file.mat')
% save only the matrix to file
save('file.mat','M')
% save only the matrix to file, with v5 format
save('file.mat','M','-v5')
Save a 2D matrix with single precision data in a .mat file:
M = [1923.71288 4023.03575 9768.82832 9195.83701 104.13143 4261.35201];
single(M);
save('file.mat','M');