Export part of the matrix to excel

10 views (last 30 days)
Natasha Elizabeth Francis
Natasha Elizabeth Francis on 18 Jun 2022
Answered: Animesh Gupta on 10 Oct 2022
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 Comment
Image Analyst
Image Analyst on 18 Jun 2022
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:

Sign in to comment.

Answers (1)

Animesh Gupta
Animesh Gupta on 10 Oct 2022
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!