필터 지우기
필터 지우기

Append rows to .mat file

조회 수: 6 (최근 30일)
Brent
Brent 2019년 11월 9일
댓글: Walter Roberson 2019년 11월 9일
How do I append row(s) of data to an existing array in a .mat file. The following works except the 2nd to last line:
tableIt = [1 2 3;4 5 6;7 8 9];
tableMore = [10 11 12];
filename = 'aTable.mat';
data2store = 'tableIt';
more2store = 'tableMore';
save(filename,data2store');
whos('-file',filename);
m = matfile(filename,'Writable',true);
m.tableIt(end+1,:) = more2store;
whos('-file',filename);
  댓글 수: 4
Walter Roberson
Walter Roberson 2019년 11월 9일
It is recommended to not use end in this context. See https://www.mathworks.com/help/matlab/ref/matlab.io.matfile.html
Brent
Brent 2019년 11월 9일
I'm looking for something that does work, do you know an alternative that works?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2019년 11월 9일
more2store = 'tableMore';
That is a 1 x 9 character vector.
tableIt = [1 2 3;4 5 6;7 8 9];
That is a 3 x 3 double.
m.tableIt(end+1,:) = more2store;
That attempts to store the 1 x 9 character vector into 3 columns of a double. That does not fit.
  댓글 수: 4
Walter Roberson
Walter Roberson 2019년 11월 9일
If you had done
more2store = tableMore;
then it would have worked.
Walter Roberson
Walter Roberson 2019년 11월 9일
http://www.cs.utoronto.ca/~chechik/courses/csc324/white.html

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by