entering tide data
David Bateman
dbateman at dbateman.org
Thu Jan 29 15:06:51 CST 2009
Brado 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
>
>
Have your data in a file tide.txt in the current directory of octave
(pwd command in octave) then cut and paste the commands I sent into
Octave's command window.
D.
--
David Bateman dbateman at dbateman.org
35 rue Gambetta +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE +33 6 72 01 06 33 (Mob)
More information about the Help-octave
mailing list