help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: entering tide data


From: Dmitri A. Sergatskov
Subject: Re: entering tide data
Date: Thu, 29 Jan 2009 15:34:30 -0600

On Thu, Jan 29, 2009 at 2:30 PM, Brado <address@hidden> wrote:
>
> d.b. sent me the following instructions:
>
> A bit of regexp magic will do the trick..
>
> fid = fopen("tide.txt");
> s = char(fread(fid)).';
> fclose(fid);
> t = regexp(s,'^\s*(\d+)\+(\d+)\s+([\.\d]+)','tokens','lineanchors');
> dte = cellfun(@(x) x(1), t)
> tme = cellfun(@(x) x(2), t)
> tide = cellfun(@(x) x(3), t)
>
> Thank you for your effort and time, however I'm completely new to
> octave/matlab. Is the above a script? how do I use it? Thanks.
>
> Here is a sample of the data: I made a mistake earlier, the date is numbered
> by the day (365).
>
> 2007022+0030   0.231
> 2007022+0100   0.238
> 2007022+0130   0.235
> 2007022+0200   0.234


fh = fopen("tide.txt");
a=fscanf(fh, "%4i%3i%f %f", [4, inf]);
plot(a(3,:),a(4,:))

seems to work for me

Dmitri.
--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]