xlswrite multidimensional array in one sheet.

I tried to export 6 x 6 x 1000 matrix from matlab to exel. However, the xlswrite overwrite it.
I used the following loop to resolve the issue
for j=1: length(Matrix,3)
xlswrite('xlsName.xls',Matrix(:.:,j),j)
end
But, it print the new data to the new sheet and it is not what I wanted.
Any help is appreciated!.
Thanks

 채택된 답변

HN
HN 2020년 6월 5일

0 개 추천

This works, in any case if someone need it
T=matrix ;
for j=1:length(matrix)
T(8*(j-1)+[1,dim(matrix)],:)=matrix(:,:,j)
end
xlswrite('filename',T,'sheetname','B2')

추가 답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 6월 5일
편집: Ameer Hamza 2020년 6월 5일

1 개 추천

First convert the data to a 2D matrix
M = rand(6, 6, 100);
M_new = reshape(permute(M, [2 1 3]), 6, []).';
and then you can use xlswrite().
writematrix() can also handle multidimensional arrays.

댓글 수: 1

HN
HN 2020년 6월 5일
편집: HN 2020년 6월 5일
Thank you Hamza. But this is still not printing each matrix in the same page. What I wanted to see was all results in one page.
Thank you

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

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

질문:

HN
2020년 6월 5일

답변:

HN
2020년 6월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by