writing large 3D .mat file into a .xls file
조회 수: 5 (최근 30일)
이전 댓글 표시
I am trying to export a 3D .mat file into an .xls or even a .txt file, but I cant do that as the load/write functions work only for 2D .mat files. The problem is that the file is large (512*512*313) [ I get the 0x800A03EC error]. Excel as far as I know cant handle more than 256 columns, and I cant transpose this directly as it is a 3D array. Any ideas?
댓글 수: 4
Sven
2013년 3월 14일
Salam, Matt's right... the big question here is what you want to do with the data after it's exported. There are some ways you could represent your 3D data in excel (putting each "page" on a separate spreadsheet, putting each "page" below the previous "page" on a single spreadsheet, etc), but none of these ways will make it very pleasant to deal with the actual excel file.
This isn't a problem that "MATLAB can't export 3D data to excel", it's more a case of "excel isn't well suited to 3D data".
채택된 답변
Sven
2013년 3월 14일
편집: Sven
2013년 3월 18일
Salam,
Here's some code that will at least get your data into excel in some form. You're right that excel has the limitation of 256 columns. Therefore I've fitted each 512-by-512 page into the available space by slicing it in half and storing two 512-by-256 pieces one above the other. I've also chosen to represent the 3rd dimension using different sheets in excel. I'm afraid that this is about the best that can be done when trying to put 3D data into excel:
A = rand(512,512,313);
A_narrow = cat(1, A(:,1:256,:), A(:,257:end,:));
for i = 1:size(A,3)
xlswrite('myfile.xls',A_narrow(:,:,i),['page_' num2str(i)], 'A1')
end
Does this at least run through without error?
댓글 수: 4
Sven
2013년 3월 14일
Ha, my suggestion would be MATLAB ;)
It's really quite well suited to 3D data, and I'd bet that if you can describe clearly what you mean by "analysis on the voxels", there will be plenty of help that you can get right on this forum for how to get MATLAB to perform such analysis.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!