How to store a matrix obtained in a particular file/directory??
30 views (last 30 days)
Show older comments
Good morning.. In fact, say I am running a program which generates a parity-check matrix of size 1000X2000... I would like to know how to save that parity check matrix for later use without having to run the program each time since it takes a lot of time...
0 Comments
Accepted Answer
Jan
on 17 Oct 2011
Data = rand(1000, 2000) > 0.3; % Testdata
save(fullfile(tempdir, 'myParityCheck.mat'), 'Data', '-mat');
And reload the values:
FileData = load(fullfile(tempdir, 'myParityCheck.mat'));
Data = FileData.Data;
2 Comments
Jan
on 17 Oct 2011
It is saved in tempdir, which replies your TEMP folder. Just type "tempdir" in the command window to find the location.
More Answers (1)
Grzegorz Knor
on 17 Oct 2011
save command stores variable in a MATLAB formatted binary file (MAT-file):
save(filename, 'your_matrix')
To load data from MAT-file into workspace use load function:
load(filename)
2 Comments
Grzegorz Knor
on 17 Oct 2011
Is 12X16H_matrix your file name and H1 matrix name?
If so, then:
save('12X16H_matrix', 'H1')
See Also
Categories
Find more on Workspace Variables and MAT-Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!