Thread Subject: How do I add header information to a matric when using the writng to file?

Subject: How do I add header information to a matric when using the writng to file?

From: Jack

Date: 19 Jun, 2009 02:45:04

Message: 1 of 4

I have a 201 x 7 numerical matrix that I want to write to file. Format doesn't really matter provided I can open it in excel (csv is probablt best, but could be ASCII, text, dlm, etc). How do I add header information for each column to the matric when I write the file? Thanks.

Subject: How do I add header information to a matric when using the writng

From: vedenev

Date: 19 Jun, 2009 08:32:11

Message: 2 of 4

Use xlswrtite function. Wrtie descritpions of colomns in first row.
Using cell arays will allow you to add stings and numbers. Example:
M={'col1','col2';10,12};
xlswrite('tmp_xls_file',M);

------------------------------------
Maxim Vedenev, Matlab Expert
vedenev@ngs.ru
http://simulations.narod.ru/

Subject: How do I add header information to a matric when using the writng to file?

From: Yair Altman

Date: 20 Jun, 2009 19:27:01

Message: 3 of 4

"Jack " <use.text.after.underscore.only_jcannon@csu.edu.au> wrote in message <h1eu3g$i7q$1@fred.mathworks.com>...
> I have a 201 x 7 numerical matrix that I want to write to file. Format doesn't really matter provided I can open it in excel (csv is probablt best, but could be ASCII, text, dlm, etc). How do I add header information for each column to the matric when I write the file? Thanks.

If you write a CSV file, it will be fast, portable (non-windows) and simple:
fprintf(...,'field #1, field #2, ...');
fprintf(...,data)

You can also use dlmwrite for this

Yair Altman
http://UndocumentedMatlab.com

Subject: How do I add header information to a matric when using the writng to file?

From: us

Date: 20 Jun, 2009 20:53:01

Message: 4 of 4

"Jack " <use.text.after.underscore.only_jcannon@csu.edu.au> wrote in message <h1eu3g$i7q$1@fred.mathworks.com>...
> I have a 201 x 7 numerical matrix that I want to write to file. Format doesn't really matter provided I can open it in excel (csv is probablt best, but could be ASCII, text, dlm, etc). How do I add header information for each column to the matric when I write the file? Thanks.

this FEX contribution might be helpful

http://www.mathworks.com/matlabcentral/fileexchange/23840

us

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
reference us 20 Jun, 2009 16:54:03
fex us 20 Jun, 2009 16:54:03
file exchange us 20 Jun, 2009 16:54:03
rssFeed for this Thread
 

MATLAB Central Terms of Use

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 Terms prior to use.

Contact us at files@mathworks.com