[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fgetl and time in csv file
From: |
Ben Abbott |
Subject: |
Re: fgetl and time in csv file |
Date: |
Fri, 11 Jul 2008 06:47:59 -0400 |
On Jul 10, 2008, at 10:35 PM, Nicholas Oleng wrote:
Sorry, forgot to attach the file.
--- On Thu, 7/10/08, Nicholas Oleng <address@hidden> wrote:
From: Nicholas Oleng <address@hidden>
Subject: Re: fgetl and time in csv file
To: "John W. Eaton" <address@hidden>
Date: Thursday, July 10, 2008, 6:26 PM
I'm using the same version. I believe the problem is specific to csv
files. See for example the following lines with the attached file.
fid=fopen("test.csv','r');
y=fgetl(fid)
This gives y = 11/5/2007 1:07,1.000469681,1448764.952,USD->NOK->EUR-
>SEK
when the first lines below the comma ought to be
11/5/2007 1:07:35 AM
Thanks
--- On Thu, 7/10/08, John W. Eaton <address@hidden> wrote:
From: John W. Eaton <address@hidden>
Subject: fgetl and time in csv file
To: address@hidden
Cc: address@hidden
Date: Thursday, July 10, 2008, 5:45 PM
On 10-Jul-2008, Nicholas Oleng wrote:
| I've got a csv file I'd like to read into Octave.
|
| The typical line is as follows:
| 9/16/2007 5:26:49 PM,1.000675626, 692981.8033,USD->DKK->EUR
|
| Unfortunately, when I use fgetl I get the following:
| 9/16/2007 5:26,1.000675626, 692981.8033,USD->DKK->EUR
| where the :49 PM is omitted for some reason. Note this is how it
appears when
opened in Excel, although one can actually view the seconds and PM
by clicking
on the individual cell.
|
| How can I remedy this so that Octave can also read the second and
the PM?
What version of Octave are
you using? Precisely how are you using
fgetl?
I'm unable to duplicate the problem with Octave 3.0.1 on my Debian
system. Here is what I see when I save the line you show above in a
file (foo.dat):
octave:1> f = fopen ("foo.dat", "r");
octave:2> fgetl (f)
ans = 9/16/2007? 5:26:49 PM,1.000675626, 692981.8033,USD->DKK->EUR
If you think you've found a bug, please send a *complete* bug report
to address@hidden (but first, please read
http://www.octave.org/bugs.html to learn how to write a helpful
report).
jwe
Nicholas,
There is no "PM" in you csv file. The content looks like ...
11/5/2007 1:07,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:08,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:08,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:09,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:10,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:10,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:11,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:11,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:12,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:12,1.000469681,1448764.952,USD->NOK->EUR->SEK
11/5/2007 1:13,1.000469681,1448764.952,USD->NOK->EUR->SEK
,,,
,,,
,,,
,,,
,,,
I suspect the original data is in excel and when you export it excel
is changing the appearance. It is not an octave problem.
Ben