Thread Subject: csvwrite ?

Subject: csvwrite ?

From: Raju Gain

Date: 18 Aug, 2008 16:42:02

Message: 1 of 2

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

Subject: csvwrite ?

From: RexGermania

Date: 19 Aug, 2008 07:22:20

Message: 2 of 2

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

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

Contact us at files@mathworks.com