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

Home » Public Forums » archive » Count duplicate elements in an array but keep their order!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Count duplicate elements in an array but keep their order! [message #85758 is a reply to message #85751] Tue, 03 September 2013 05:58 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Josh Sixsmith writes:

> The following might work.
> Using the UNIQ function will give the indices, which you can use to get the value counts.
> To get the counts for each value you'll then need to use the SHIFT function to offset the indices in order subtract from the original indices.

Using the UNIQ function on a floating point array is probably a bad
idea. You might find that ALL your floating point numbers are unique,
depending upon how you arrive at them.

I think to solve this problem you are going to have to convert the
floats to integers of whatever degree of "floating" accuracy makes sense
for the problem. Then work with the integers to find, count, and remove
duplicates.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Evenly timed events in a widget program
Next Topic: Texture image on a 3d curve: cgsurface and xobjview problems

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

Current Time: Wed Oct 08 18:10:11 PDT 2025

Total time taken to generate the page: 0.00467 seconds