help-octave
[Top][All Lists]
Advanced

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

Re: How can I this efficiently? common rows in two data sets


From: Rick Niles
Subject: Re: How can I this efficiently? common rows in two data sets
Date: Thu, 12 May 2005 19:13:05 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

It was a bit more complicated because the files contained different kinds of data, so I had to put them in a matrix together with a "key" column so I could be sure I could separate them out afterward, but your suggestion did the trick, now it's super fast!

Note to self: Turn everything into a sort and it will go nice and fast. (hmm, what is the philosophical means of this?)

   Thanks,
   Rick Niles.


Keith Goodman wrote:

I would stack the two datasets into a single dataset. Then I would use
sortrows on the time column. Then do time(2:end)-time(1:end-1)==0 to
find matches. Then pull the matched rows out into a new matrix.

On 5/12/05, Rick Niles <address@hidden> wrote:
OK I have a problem I hit a lot and I haven't come up with a good way to
do this Octave.  I was wondering if there's a good way to do this or if
it's a opportunity for another built-in oct-file if there's not a good
way to do it with the current set of the functions.

I have two data files, each has one column that represents "time".  But
they don't start and stop at the same time and either may have random
drop-outs (no-data) for any amount of time.   The obvious thing to do
make a common data set that only contains the times (rows) for which I
have data from both sets.

I tried using "intersection()" on the time columns and doing a for loop
with "find()" for each time value one at a time to get the indexes that
have common time, but on a large data set it's really slow and obviously
not very efficient.

As lots of people use Octave to process real data sets it seems like
there should be a good way to do this.

Any ideas?

   Thanks,
   Rick Niles.

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------





-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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