How to output a large matrix to one excel with multiple sheets in specific size?

1 view (last 30 days)
Hello,
I have a large matrix (289x46) which are x and y data. The first 289x23 are x data, and the rest 289x23 are y data. I want to export each column of x and y from the matrix to one sheet in excel, move to the next column of x and y, output again ans so on. Therefor I can have 23 sheets after output. How can I make this happen?
Thank you.

Accepted Answer

Voss
Voss on 25 Apr 2022
Edited: Voss on 26 Apr 2022
% a 289x52 matrix:
xy = readmatrix('test100_4.4.22cellsmeetcriteria.xlsx');
% write each pair of columns (one x and one y)
% to a sheet of output.xlsx, for the first 23 pairs:
for ii = 1:23
writematrix([xy(:,ii) xy(:,ii+23)],'output.xlsx','Sheet',ii);
end
  4 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!