Store an indexed matrix to later recall

조회 수: 1 (최근 30일)
AR
AR 2015년 12월 4일
편집: Walter Roberson 2015년 12월 4일
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