3D Matrix (n*m*p) in Table

9 views (last 30 days)
Hayfa R
Hayfa R on 31 Mar 2019
Answered: Hayfa R on 1 Apr 2019
Hello,
I m trying to convert a 3D matrix (n*m*p) in a p* excel sheets with an (n*m) Table in each sheet,
I tried to do it in a for loop but i cant create a 3D Table, and I cant change the variable inside the loop.
Can you please help me. thanks
  1 Comment
dpb
dpb on 31 Mar 2019
Edited: dpb on 31 Mar 2019
Should be no problem at all...show us the code you tried and to ensure we're on the same page what the output from
whos X
where "X" is the variable name of your 3D array.

Sign in to comment.

Accepted Answer

Akira Agata
Akira Agata on 1 Apr 2019
How about the following?
% Sample data (n,m,p were assumed to be 20,10,5,respectively)
A = rand(20,10,5);
% Save as an Excel file
for kk = 1:size(A,3)
xlswrite('yourExcel.xlsx',A(:,:,kk),kk);
end

More Answers (2)

Hayfa R
Hayfa R on 1 Apr 2019
It worked well! thank you!

Community Treasure Hunt

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

Start Hunting!