Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: xlswrite?

Subject: xlswrite?

From: Cooky Monster

Date: 11 Sep, 2007 10:06:34

Message: 1 of 2

Dear All

I have a matrix M of three columns and 100 rows. I like to
export it to Excel. I have to add the lables also.

I am using

Titles = {'Number of Cycles', 'Crack Length','Crack Growth
Rate'}
Labels = {'Cycles', 'a','da/dN'}
Units = {'[Cycles]', '[mm]','[mm/Cycles]'}
[newmatfile, newpath] = uiputfile('*.xls', 'Save As');
filename = [newpath,newmatfile];
if isempty(findstr([newpath,newmatfile],'.xls'))
   filename = [filename,'.xls'];
end

xlswrite(filename, Titles, 1, 'A2')
xlswrite(filename, Labels, 1, 'A3')
xlswrite(filename, Units, 1, 'A4')
xlswrite(filename, M,1, 'A6')

I like to ask if I can auto width the columns in Excel
sheet using any matlab command and also to change the font
size.

Thanks in Advance

Regards

Subject: xlswrite?

From: Yair Altman

Date: 11 Sep, 2007 10:44:44

Message: 2 of 2

"Cooky Monster" <sharif.uk@gmail.com> wrote in message
<snip>
> I like to ask if I can auto width the columns in Excel
> sheet using any matlab command and also to change the font
> size.


You cannot do this with xlswrite. However, you can do this
by directly accessing the Excel COM server and running
column-width and font-size VB commands on that server. The
same applies to any other formating you may wish to do on
the data. To see how to do this, you can edit xlswrite.m:
It's a relatively long function, but if you ignore the
error-checking parts, you'll see that the actual skeleton is
pretty small.

An alternative is to use the OfficeDoc submission on the
File Exchange:
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=15192

Yair Altman
http://ymasoftware.com

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics