Store an indexed matrix to later recall

1 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2015-12-4
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 个评论
AR
AR 2015-12-4
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 2015-12-4
编辑:Walter Roberson 2015-12-4
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 .'

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by