In matlab I am getting a matrix of MxN size, I need to store this in secondary storage for retrieval in future. How I can store a matrix permanently and how it's possible to read into a variable.
Asked
Active
Viewed 210 times
-3
-
3This is a very simple question. Did you even searched online? If you put `save matrix matlab` in google, the first link is the answer. C'mon... – SamuelNLP Jun 18 '15 at 10:23
1 Answers
-1
Say your matrix is m
. Save it to a file:
save myfile.mat m
You can save it as ascii:
save('myfile.txt','m','-ascii')
or as save -ascii myfile.txt m
.
You can see the contents of this file:
type('myfile.txt')
You can load all the contents of your mat
file:
load myfile.mat
or a specific variable:
load('myfile.mat','m')
or simply load myfile.mat m
. Similarly load your data from the ascii file:
load myfile.txt -ascii
Once you have loaded the data from the mat
or ascii
files you have the matrix m
and you can set it equal to any variable that you like.

Vidhya G
- 2,250
- 1
- 25
- 28