[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading data using fgets in while loop
From: |
indium |
Subject: |
Re: reading data using fgets in while loop |
Date: |
Tue, 13 Mar 2012 08:53:27 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Mon, Mar 12, 2012 at 01:33:46PM -0400, financial engineer wrote:
> hi Indium,
> understood, the {} works vs. ().
> but then I also tried the date conversion as in your code (since my date
> format is mm/dd/yyyy), I wrote the following:
> datestring=sprintf('%s',tline{1});
> pos27sec(n)=mktime(strptime(datestring,'%m/%d/%Y'));
>
> pos27sec =
>
> Columns 1 through 6:
>
> 1.3256e+09 1.3257e+09 1.3257e+09 1.3258e+09 1.3261e+09 1.3262e+09
>
> Columns 7 through 12:
>
> 1.3263e+09 1.3263e+09 1.3264e+09 1.3268e+09 1.3269e+09 1.3269e+09
>
> Columns 13 through 18:
>
> 1.3270e+09 1.3273e+09 1.3274e+09 1.3275e+09 1.3276e+09 1.3276e+09
>
> Columns 19 through 24:
>
> 1.3279e+09 1.3280e+09 1.3281e+09 1.3282e+09 1.3282e+09 1.3285e+09
>
> Columns 25 through 30:
>
> 1.3286e+09 1.3287e+09 1.3288e+09 1.3288e+09 1.3291e+09 1.3292e+09
>
>
>
I think that's correct: the number of seconds since 1970, or something like
that . You can find the definition in 'doc mktime'. There might well be smarter
ways to do this: I just search in the manual for 'date' or 'time' and then I
use whatever function that seems to suite me. Like in the answer of Philipe,
you see that there are smarter ways to read a text file. Probably true for
treating dates as well.
- reading data using fgets in while loop, newbie_octave, 2012/03/11
- Re: reading data using fgets in while loop, indium, 2012/03/12
- Re: reading data using fgets in while loop, indium, 2012/03/12
- RE: reading data using fgets in while loop, financial engineer, 2012/03/12
- Re: reading data using fgets in while loop, indium, 2012/03/12
- RE: reading data using fgets in while loop, financial engineer, 2012/03/12
- Re: reading data using fgets in while loop, indium, 2012/03/12
- RE: reading data using fgets in while loop, financial engineer, 2012/03/12
- Re: reading data using fgets in while loop,
indium <=
- RE: reading data using fgets in while loop, financial engineer, 2012/03/13
Re: reading data using fgets in while loop, PhilipNienhuis, 2012/03/12