comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Remove Duplicate Rows
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Remove Duplicate Rows [message #82914] Thu, 24 January 2013 19:42 Go to next message
Gompie is currently offline  Gompie
Messages: 76
Registered: August 2012
Member
Hi,
I have a 500x500 array of floats. Some of the rows are duplicate.
How do I remove these duplicate rows.
Thanks in advance.
Gompie
Re: Remove Duplicate Rows [message #82961 is a reply to message #82914] Tue, 29 January 2013 05:06 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den lördagen den 26:e januari 2013 kl. 21:00:50 UTC+1 skrev Gompie:
> Thanks Mats !!1
>
> Wunderbar !!1 Danke !!! Thanks !!! It works great !!!

Great!
Re: Remove Duplicate Rows [message #82982 is a reply to message #82914] Sat, 26 January 2013 12:00 Go to previous message
Gompie is currently offline  Gompie
Messages: 76
Registered: August 2012
Member
Thanks Mats !!1
Wunderbar !!1 Danke !!! Thanks !!! It works great !!!
Re: Remove Duplicate Rows [message #82988 is a reply to message #82914] Sat, 26 January 2013 07:32 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
On Saturday, January 26, 2013 2:25:56 PM UTC+1, Gompie wrote:
> Thanks Mat
>
> I want to first remove duplicate rows( which your code already does).
>
> I then want to sum up each duplicate column to get a sum columns.
>
> I then want to replace every pair of duplicate columns with the sum columns.
>
> Gompie

Oh, columns! I missed that part. Well, you can use uniqrows to find duplicate columns, too. Just use the OP keyword to change what index it considers the row index. And then I imagine the summing could proceed much like I've already outlined.
Re: Remove Duplicate Rows [message #82989 is a reply to message #82914] Sat, 26 January 2013 05:25 Go to previous message
Gompie is currently offline  Gompie
Messages: 76
Registered: August 2012
Member
Thanks Mat
I want to first remove duplicate rows( which your code already does).
I then want to sum up each duplicate column to get a sum columns.
I then want to replace every pair of duplicate columns with the sum columns.
Gompie
Re: Remove Duplicate Rows [message #82990 is a reply to message #82914] Sat, 26 January 2013 02:09 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
On Saturday, January 26, 2013 11:02:33 AM UTC+1, Mats Löfdahl wrote:
> On Saturday, January 26, 2013 1:03:37 AM UTC+1, Gompie wrote:
>
>> Pretty easy for you to do because you wrote the uniq-rows code..but hard for me to follow.
>
>
>
> Well, it wasn't meant as detailed instructions. I just tried to get an idea across so you could figure the details out for yourself.

I'll make another attempt, and this time not just before bedtime...

As I understood your problem, you wanted to remove duplicate rows and then instead co-add them. That would be equivalent to multiply the first copy of the duplicated row with the number of copies. So my idea was to define an array of factors to multiply each row with. It would start out as unity for each row but everytime you found a duplicate you would add one to the position corresponding to the first copy, the one you are going to keep. And when you have found all the duplicate rows, you'd apply those multiplicative factors to the rows before removing the duplicates.
Re: Remove Duplicate Rows [message #82991 is a reply to message #82914] Sat, 26 January 2013 02:02 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
On Saturday, January 26, 2013 1:03:37 AM UTC+1, Gompie wrote:
> Pretty easy for you to do because you wrote the uniq-rows code..but hard for me to follow.

Well, it wasn't meant as detailed instructions. I just tried to get an idea across so you could figure the details out for yourself.
Re: Remove Duplicate Rows [message #82992 is a reply to message #82914] Fri, 25 January 2013 16:03 Go to previous message
Gompie is currently offline  Gompie
Messages: 76
Registered: August 2012
Member
Pretty easy for you to do because you wrote the uniq-rows code..but hard for me to follow.
Re: Remove Duplicate Rows [message #82996 is a reply to message #82914] Fri, 25 January 2013 15:20 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
On Saturday, January 26, 2013 12:05:37 AM UTC+1, Gompie wrote:
> Thanks Mats !!!
>
> The Marks uniq and your uniq pro worked well.
>
> But now I want to sum the repeated columns and replace the repeated by the sum.
>
> Any help !!!

One way of doing it would be to make a modified version of the uniqrows function under a new name.

At the point where a duplicate rowis found (row i equals row j), the index j is stored in the duplicateindx array for later removal. At that point you could add 1 to the i:th element of another array (that is as long as the number of rows and initialized to unity in all elements before the loop starts), lets call it multfac. And then, before removing the duplicate rows, loop for i=0,Nrows-1 and multiply row i by multfac[i].

Something like that should work.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Remove Duplicate Rows
Next Topic: Re: 3-D arrows

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:12:09 PDT 2025

Total time taken to generate the page: 0.00649 seconds