Store an indexed matrix to later recall

2 Ansichten (letzte 30 Tage)
AR
AR am 4 Dez. 2015
Bearbeitet: Walter Roberson am 4 Dez. 2015
Hello. I have a vector (1,12100) of indexed matrices [64 3] which I would like to recall specific indexed sets. All values are numbers. Tried dlmwrite but it causes my PC freeze and tried variations of fprintf like below but get errors.
fprintf(fileID,'%.6f\t\r\n',{X});
Any ideas on how best to file these sets for later recall? I would like to recall a [64 3] set via its indexed number which is from 1 to 12,100.
Thank you. --Allen

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 4 Dez. 2015
You can save() them as a cell array. If you really need to be able to restore individual members without reading the rest, then you can use matFile() with a cell array
You should also consider saving as a 3 dimensional array, 64 x 3 x 12100
  2 Kommentare
AR
AR am 4 Dez. 2015
Walter, Could I use this 3D Array, X={[64x3] [64x3] [64x3] [64x3] etc}, in fprintf somehow to save in a txt file? Thx, Allen
Walter Roberson
Walter Roberson am 4 Dez. 2015
Bearbeitet: Walter Roberson am 4 Dez. 2015
Yes; what format would you want? Is there to be three columns on each line? Is there to be some kind of marker between indices?
If it can just be (64*12100) rows of 3 columns then assuming you are starting with a cell array
temp1 = YourCell(:);
temp2 = vertcat(temp1{:});
fprintf(fid, '%.6f\t%6f\t%.6f\r\n', temp2.' ); %note .'
If you are starting with a 64 x 3 x 12100 array then
temp2 = permute(YourArray, [2 1 3]);
fprintf(fid, '%.6f\t%6f\t%.6f\r\n', temp2 ); %no .'

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by