Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news-fra1.dfn.de!news-lei1.dfn.de!news.tu-chemnitz.de!news.eastlink.de!hermes.gmbu-jena.de!news
From: RexGermania <berla@gmbu-jena.de>
Newsgroups: comp.soft-sys.matlab
Subject: Re: csvwrite ?
Date: Tue, 19 Aug 2008 09:22:20 +0200
Lines: 39
Message-ID: <bu8qn5-rr3.ln1@hermes.gmbu-jena.de>
References: <g8c8oq$fva$1@fred.mathworks.com>
NNTP-Posting-Host: gmbu.gmbu-jena.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: el-srv04-CHE.srvnet.eastlink.de 1219130823 18895 217.65.31.6 (19 Aug 2008 07:27:03 GMT)
X-Complaints-To: abuse@eastlink.de
NNTP-Posting-Date: Tue, 19 Aug 2008 07:27:03 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
In-Reply-To: <g8c8oq$fva$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:486172



Raju Gain schrieb:
> Hello Everyone,
> 
> I am trying to write a 2 dimensional array variable with 6 
> rows and 4 columns into a csv file using csvwrite. my 
> first row is the column headers. I am not sure if csvwrite 
> can write headers? I tried removing the headers and it 
> worked fine but with the headers throws an error.
> 
> 'A'    'B'    'C'    'D'
>     [           1]    [11]    [12]    [13]
>     [           2]    [21]    [22]    [23]
>     [           3]    [31]    [32]    [33]
>     [           4]    [41]    [42]    [43]
>     [           5]    [51]    [52]    [53]
> 
> Can anyone tell me a way to write the values with the 
> headers into a CSV file? 
> 
> Thanks
This should be a good starting point. I modified Francis Barnhart's 
function CELLWRITE to do the same thing for me sometime ago. You may 
change the permisions in fopen to 'a'   (append). Then call the function 
twice:
1st to write the header
2nd to write the array

You'll find it at MATLAB Central File exchange. I'm not sure if I'm 
allowed to copy and paste hier!

Author:  	Francis Barnhart
Summary: 	Cellwrite writes mixed cell array data to a CSV file.
MATLAB Release: 	R13
Description: 	This function implements the basic functionallity of 
csvwrite but operates on cell arrays of mixed data (numeric and string) 
instead of arrays of numeric data.
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=7363&objectType=file

RexGer