필터 지우기
필터 지우기

writing/ exporting 3D data set/matrix from Matlab to EXCEL

조회 수: 8 (최근 30일)
Amine Ben Ayara
Amine Ben Ayara 2016년 2월 2일
댓글: Walter Roberson 2016년 2월 3일
I have a multi dimension matrix (:,:,:) that I need to export to excel, The data is basically formed of 44040 (5*5) matrices. (:,:,44040) I tried xlswrite command but I kept getting some dimension errors. Any ideas, please! Thank you guys!
  댓글 수: 2
Joseph Cheng
Joseph Cheng 2016년 2월 3일
How do you expect excel to handle a 3d matrix? How do you want the 3rd dimension to be represented in excel?
Amine Ben Ayara
Amine Ben Ayara 2016년 2월 3일
the matrix is (5*5) and there are 44040 of them, so perhaps they can be stored in 3 separate sheets; 14680 (5*5) matrix in each sheet?

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

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 3일
xlswrite() of reshape(YourArray, size(YourArray,1), []) and be sure to use an .xlsx output (you would have too many rows for .xls)
It would be possible to create a spreadsheet with 44040 "sheets" each of which is 5 x 5, but that would seem to be a bit of a waste.
  댓글 수: 2
Amine Ben Ayara
Amine Ben Ayara 2016년 2월 3일
Thank you so much Walter, the command reshape worked perfect. I do have one other issue that I don't know how to track. I have an (44040*8) matrix as part of my input matrices that i'm using for a simulation. Basically the simulation consists of increasing all the values/elements of 2nd column from this input matrix; lets suppose it's called X. so I wrote for k=1:100; X(:,2)=X(:,2)+k; ( some other code). So every iteration, will increase the elements of X(:,2) ( only second column by k. However, I need to make sure that going from one iteration to the next, the values of X(:,2) ( in the second column) need to be reset to their original values X(:,2). what would you recommend? Thank you so much
Walter Roberson
Walter Roberson 2016년 2월 3일
X2 = X(:,2);
for K = 1 : 100;
X(:,2) = X2 + K;
...
end
Or since you are incrementing by 1 each time,
for K = 1 : 100
X(:,2) = X(:,2) + 1;
...
end

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by