[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using cell2csv
From: |
richard |
Subject: |
Re: Using cell2csv |
Date: |
Tue, 11 Jun 2013 09:30:28 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Tue, Jun 11, 2013 at 03:08:11PM +1000, Terry Duell wrote:
> Hello All,
> I'm running into a few difficulties figuring how best to use
> "cell2csv" to capture results.
> I really don't have a sound grasp of cell array indexing, and that
> isn't helping.
> In my script I first generate a cell array "datavals{1}" to hold
> text describing the contents of each column of data in the csv file.
> On each run through a loop I then add my calculated values as follows...
>
> datavals{i+1}={filename, val1, val2, val3...};
>
> When the calculation loops are done, I am trying to write "datavals"
> to a file, with the aim of having each entry written to the file as
> a separate record, using the following...
> for i=1:n
> cell2csv("filename",datavals{i});
> end
>
> but this only leaves me with the values for the last write
> operation, ie the file is being overwritten.
> It doesn't seem like "cell2csv" has an "append" switch.
> I have tried opening a file...
>
> fp = fopen("filename","a");
>
> and using
>
> cell2csv(fp, datavals{i}); within my write loop, but that also ends
> up with only the last write.
>
> Can someone please point me to a solution?
>
A couple of questions:
When you open the file is it possible to set the mode to append?
Also, Have you considered the "database" application - you mention
columns of data? Would that be more suited to your needs?
regards
Richard A Lough