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

1 回表示 (過去 30 日間)
Yang Hu
Yang Hu 2022 年 4 月 25 日
コメント済み: Voss 2022 年 4 月 26 日
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.

採用された回答

Voss
Voss 2022 年 4 月 25 日
編集済み: Voss 2022 年 4 月 26 日
% 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 件のコメント
Yang Hu
Yang Hu 2022 年 4 月 26 日
It's working, thank you very much!
Voss
Voss 2022 年 4 月 26 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by