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?

 Akzeptierte Antwort

Adam
Adam am 4 Nov. 2015
Bearbeitet: Adam am 25 Jun. 2018

0 Stimmen

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 Kommentare

rihab
rihab am 4 Nov. 2015
I did it in this way; but whenever i try to click say 'Somefile', load('Somefile.mat') appears in command prompt and then no values of say myMatrix are displayed.
rihab
rihab am 4 Nov. 2015
For eg.
filename = 'Macintosh HD\Users\rb\Desktop\ab.mat';
save(filename ,'ax')
It always shows load('Macintosh HD\Users\rb\Desktop\filesb\ab.mat')
Adam
Adam am 4 Nov. 2015
What do you mean by 'displayed'? It won't display anything from the file when you load it, but it will load whatever is in the file into your workspace.
rihab
rihab am 4 Nov. 2015
Got it! actually I hadn't checked the workspace. thanks!
Luthando Maqondo
Luthando Maqondo am 24 Jun. 2018
This does not save the Matrix as it is, it stored a struct version of if and now I can't index the elements in side the matrices. Even the size(Matrix) function gives a 1x1 for a matrix expected to be 4 dimentional;
Adam
Adam am 25 Jun. 2018
It works fine for me. I get the same matrix in file as I do in my workspace.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Gefragt:

am 4 Nov. 2015

Kommentiert:

am 25 Jun. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by