|
From: | David Bateman |
Subject: | Re: entering tide data |
Date: | Thu, 29 Jan 2009 21:22:33 +0100 |
User-agent: | Mozilla-Thunderbird 2.0.0.17 (X11/20081018) |
Brado wrote:
Hello, I'd really appreciate some help to get me started on octave. Surely thefirst steps are the hardest.Here is my problem: I'd like to import data from a tide gauge. It's in thefollowing format:date+time 006-pwl it looks something like this in the file: 2007022+0000 0.229 the first group of numbers are date+time, the second the actual water level measurement. How do I modify the appropriate command (load?) to import and make sense of this data?? Thanks B
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) D. -- David Bateman address@hidden 35 rue Gambetta +33 1 46 04 02 18 (Home) 92100 Boulogne-Billancourt FRANCE +33 6 72 01 06 33 (Mob)
[Prev in Thread] | Current Thread | [Next in Thread] |