Re: Finding the Non-Matching elements in two vectors [message #30246] |
Sun, 14 April 2002 07:57 |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Nate Doyle wrote:
>
> Hi there,
> I'm pretty new to this whole IDL thing and was wondering if some of
> you could give me some help finding a solution to a little problem I'm
> having.
> The problem is this:
> I have three files that contain some data and I need to make sure that
> they all have the same amount. I have extracted a bunch of integers
> from each file and put them into vectors, one for each file. The
> numbers should match up because they are the days on which the data
> was collected and are consistant through out. The end result of my
> program is to make sure that the third file basically contains a list
> of all the matching elements of the first two. Or since I feel like
> I'm not being clear:
>
> It should be like this when I match the vectors up.
>
> File one: 2 7 9 10 15 17....
> File two: 2 7 9 10 15 17....
>
> File one: 2 7 9 10 15 17....
> File three: 2 7 9 10 15 17....
>
Dear Nate,
we have several of routines for such kind of problems.
For this case you asked you can try our:
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/a_and_b.tar.gz
There are some more Routines like
a_not_b.pro a_or_b.pro a_xor_b.pro
Please have a look at
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml too.
regards
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
|
|
|
Re: Finding the Non-Matching elements in two vectors [message #30268 is a reply to message #30246] |
Thu, 11 April 2002 13:25  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Nate Doyle (doyle@lasp.colorado.edu) writes:
> I'm pretty new to this whole IDL thing and was wondering if some of
> you could give me some help finding a solution to a little problem I'm
> having.
> The problem is this:
> I have three files that contain some data and I need to make sure that
> they all have the same amount. I have extracted a bunch of integers
> from each file and put them into vectors, one for each file. The
> numbers should match up because they are the days on which the data
> was collected and are consistant through out. The end result of my
> program is to make sure that the third file basically contains a list
> of all the matching elements of the first two. Or since I feel like
> I'm not being clear:
>
> It should be like this when I match the vectors up.
>
> File one: 2 7 9 10 15 17....
> File two: 2 7 9 10 15 17....
>
> File one: 2 7 9 10 15 17....
> File three: 2 7 9 10 15 17....
>
> Unfortunatly its not because there are some elements not in the third
> file that are in the other two. So when I match the vectors together
> I get that file one and file two match 16 elements and file one and
> file three match 14 elements. With this few mis-matched elements I
> can easily print the data and read through it. This 2 element
> difference, however, is only over a loop of about 150 data points and
> I have 3800 total to calculate. As you can imagine trying to sift
> through that much data visually would be worse than tedious. So I
> appeal to you folks to give me a hand with finding a quick print out
> of all the non-matching days so that I find out where I need to patch
> up holes in my data file.
Try the SetDifference function described on this page:
http://www.dfanning.com/tips/set_operations.html
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|