Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: irritating little problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32937] Re: irritating little problem
  • From: Thomas Burton <tburton at brahea.com>
  • Date: Wed, 20 Feb 2002 01:26:19 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

Given a vector v,

v = {b, a, b, b, c, d, e, d, f, d, c, b, c, g};

I would recommend the following method. First, append the positions to the
values:

vv = Transpose[{v, Range[Length[v]]}]

Next, sort and split into sublists of equal values.

vs = Split[Sort[vv],  First[#1] == First[#2] & ]

What you do next depends upon details I don't know.

Hope this helps.

Tom Burton

On 2/18/02 11:36 PM, in article a4sv9c$ido$1 at smc.vnet.net, "KIMIC Weijnitz
Peter" <micweij at eka.ericsson.se> wrote:

> I have a simple vector
> and I want to find the position of elements that are equal.
> 
> I.e I want to test the vector and find all cases of similar elements.
> 
> Brute force is not what I want, it can be a long vector.
> Best regards
> Petr W
> 




  • Prev by Date: Re: Manipulating Pattern Matching ?
  • Next by Date: Re: Problems using Plot function
  • Previous by thread: Re: irritating little problem
  • Next by thread: RE: irritating little problem