MATLAB Answers

Exporting matrix into an Excel file

10 ビュー (過去 30 日間)
Mahdiyar
Mahdiyar 2013 年 4 月 17 日
Hi everyone
I have a huge matrix and I want to export that into an Excel file by use of xlswrit. This command does not work for me and I think that it is due to the large size of matrix. I want to know that what is the maximum size of a matrix that be able to be exported?
Can anyone help about that if there is any other command (for exporting into an excel file)?
Thank you in advance.

回答 (1 件)

Jonathan Epperl
Jonathan Epperl 2013 年 4 月 17 日
From the documentation on xlswrite:
A — Data to write matrix | cell array
Data to write, specified as a two-dimensional numeric or character array, or, if each cell contains a single element, a cell array.
If A is a cell array containing something other than a scalar numeric or a string, then xlswrite silently leaves the corresponding cell in the spreadsheet empty.
The maximum size of array A depends on the associated Excel version. For more information on Excel specifications and limits, see the Excel help.
Now a little Google yields for e.g. Excel 2010:
Worksheet size 1,048,576 rows by 16,384 columns
For Excel 2003 it is much less. Since your matrix is "huge" you're likely exceeding the column limit.
You could try csvwrite or dlmwrite to store your data, a simple text file should not have any limits. However, you won't be able to import or open those files in Excel then.
If that doesn't solve your question, then post more details, like the Matlab and Excel Versions you are using, the dimensions of your matrix, and the error message!

Community Treasure Hunt

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

Start Hunting!

Translated by