[Top][All Lists]

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

Re: How do you select only specific rows based on the values in a specif

From: Doug Stewart
Subject: Re: How do you select only specific rows based on the values in a specific column?
Date: Sat, 25 Oct 2014 22:43:22 -0400

On Sat, Oct 25, 2014 at 8:29 PM, Thompson, Robert M - (rmt1) <address@hidden> wrote:
I have a huge source file of a million lines, like: (cartographic data)

    0.015625   89.996094    0.018000
    0.046875   89.996094    0.018000
    0.078125   89.996094    0.018000
    0.109375   89.996094    0.018000
    0.140625   89.996094    0.018000
    0.171875   89.996094    0.018000
    0.203125   89.996094    0.018000
    0.234375   89.996094    0.018000
    0.265625   89.996094    0.018000
    0.296875   89.996094    0.018000

I was using C to pare the source file down into a smaller file based on values in first and second column.

The evaluation was like, e.g., keep this row if column 1 is greater than 0.20000 and column 2 is >= 89.00000.

Then I was loading that NEW file (XYZ) into octave, using...

load XYZ;x=XYZ(:,1);y=XYZ(:,2);z=XYZ(:,3);

...and EVERY record of XYZ was necessary, and every single x, y and z was data I required.

But now I want to cut out the C middleman and import the million-line source file directly into Octave.

But also select only the rows with first or second columns matching criteria, before I consume great amounts of memory on records I will not be using.

Any small examples?

Thank you

Help-octave mailing list

This may help 
 a( (a(:,1)>.04 & a(:,2)>=89   ),:)

reply via email to

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