MATLAB Answers

Save a matrix in MATLAB

414 views (last 30 days)
rihab
rihab on 4 Nov 2015
Commented: Adam on 25 Jun 2018
I have a 100x100 matrix in MATLAB and I want to save it in matlab format. Is there a way to do so in MATLAB?

Accepted Answer

Adam
Adam on 4 Nov 2015
Edited: Adam on 25 Jun 2018
save( filename, 'matrixName' )
e.g.
myMatrix = rand( 100, 100 );
filename = 'C:\Stuff\Somefile.mat';
save( filename, 'myMatrix' );
Be sure to use the .mat extension for your file.
  6 Comments
Adam
Adam on 25 Jun 2018
It works fine for me. I get the same matrix in file as I do in my workspace.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!