[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trying to extract data after several non-data lines
From: |
Jaroslav Hajek |
Subject: |
Re: Trying to extract data after several non-data lines |
Date: |
Mon, 25 Jan 2010 07:07:12 +0100 |
On Mon, Jan 25, 2010 at 5:38 AM, Jason Hsu, Linux user
<address@hidden> wrote:
> I'm trying to process data in a file.
>
> The first part of the file consists of several lines that are irrelevant as
> far as the data processing goes.
>
> The last line before the data begins reads
> "X_Value,Voltage_wrist,Voltage_midarm,Comment".
>
> The data consists of three columns of comma-separated floating-point numbers.
>
> I'm using the fgetl command to read the lines in the file. But I can't
> figure out for the life of me how to get the algorithm to notice
> "X_Value,Voltage_wrist,Voltage_midarm,Comment" so it can start switching to a
> different mode.
>
> Can someone shed some light on how to get the algorithm to notice that
> particular line?
>
> --
> Jason Hsu, Linux user <address@hidden>
do
line = fgetl (fid);
line(isspace (line)) = []; # ignore whitespace
until strcmp (line, "X_Value,Voltage_wrist,Voltage_midarm,Comment");
# begin normal processing
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz