File Exchange

image thumbnail

Export2Excel

version 1.0 (77.3 KB) by

A function which exports a given Matlab array / Cell array to an Excel Spreadsheet.

3 Downloads

Updated

View License

EXPORT2EXCEL function exports a Matlab array / Cell array to Excel spreadsheet.

Microsoft Excel activex server i.e Excel Com object is used to export data from Matlab to Excel.Hence Microsoft Excel is a must to have for exporting data from this function.

This Function also changes the Cell Properties.Color of each Cell containing data in the spreadsheet will be Yellow. Excel has 56 Color Index Values to Choose from.

Use conditional formatting for changing Cell color depending on its Value.

An Excel sheet containing the 56 colors and corresponding color indicies is included in this package(Colors.xls file).

The Maximum number of Columns supported by this release is 702 for Excel 2007 and 256 for Excel 2003.

A Matlab array / Cell array with columns greater than the above mentioned limits is not supported.

Error messages corresponding to invalid input and array exceeding Columns are thrown on to Matlab Command Prompt.

Versionflag determines the version of Excel, this is needed because Excel 2003 can import only 256 columns (i.e from 'A' to 'IV') of data and Excel 2007 allows a large number of columns to be imported, but in this program no of columns for Excel 2007 are restricted 702 (i.e from 'A' to 'ZZ')

E.g. 1) Flag = Export2Excel(ones(100,100),'A4');
default version flag 0 i.e Excel 2003 is assumed to be
present on the system
2) x = [1 2 3 4];
Flag = Export2Excel(x,'B4',1);
version flag 1 specified i.e Excel 2007 is assumed to be present on the system.

Comments and Ratings (2)

Shameemraj Nadaf

Thanks for finding the bug Herve ... I will fix it asap ...

Herve

Herve (view profile)

It can be a great tool...
But it only works if you give the row of firstcell is between 1 and 9.

Export2Excel(data,'B2') will work.
Export2Excel(data,'BB2') will work.

Export2Excel(data,'B22') will not work.

??? Undefined function or variable "lastcell".

Error in ==> Export2Excel at 84
lastcell = strcat(lastcell,num2str(m+(row_number-1)));

MATLAB Release
MATLAB 7.5 (R2007b)
Tags Add Tags

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video