Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

vector ordering problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126697] vector ordering problem
  • From: Marco Lazzaretti <marco.lazzaretti82 at gmail.com>
  • Date: Thu, 31 May 2012 02:51:02 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hi,
I have these two vectors, vector1 and vector2.
I need to have  vector2 sorted by a positions vector, given by a
vector1.
e.g.
vector1 ={32,4,28,11,20}
position_vector1= Ordering[vector1]
position_vector1 = {5,1,4,2,3}

vector2 = {78,12,95,14,35}

requested output
{35,78,14,12,95}

that is, I have this position vector, as an output from another
calculation; then i need my input vector to be sorted as the position
vector says.
Obviously, my real input vector is quite bigger so i can't sort it
manually... I hope the small example can explain my problem better
than my words...



  • Prev by Date: Re: How to add axis labels in bubblechart?
  • Next by Date: Re: How to add axis labels in bubblechart?
  • Previous by thread: How to render 3D Texture as solid body?
  • Next by thread: Re: Sum of Products - Complete The Square