Export part of the matrix to excel

5 次查看(过去 30 天)
I understand that a matrix output could be exported to excel using the writematrix command. But it has a limit when it is a large matrix. I got the following error 'The data block starting at cell 'A1' exceeds the sheet boundaries by 0 row(s) and 249744 column(s)'. Is it possible that I can extract part of the matrix to excel in matlab?
  1 个评论
Image Analyst
Image Analyst 2022-6-18
What is the size of your matrix, and what section do you want to extract and export to Excel?
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:

请先登录,再进行评论。

回答(1 个)

Animesh Gupta
Animesh Gupta 2022-10-10
Hello,
It is my understansing that you want to extract part of the matrix and export it to excel.
The interested part of the matrix can be extracted by using square brackets and then extracted using writematrix.
You may refer the following script to understand the procedure
arr = rand(1024,100024);
writematrix(arr([1:100], [1:744]), 'out.xlsx'); % () are used for indexing and [] are used for truncation.
Please note that MATLAB supports .xls, .xlsm, .xlsx formats of excel to export to. Based on the upper limit of rows and columns, any of these can be chosen.
I hope it helps.

Community Treasure Hunt

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

Start Hunting!

Translated by