MathGroup Archive 2008

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

Search the Archive

Re: help to find position location


> I'm stuck to find the position of (the Max value in ) each row.

Hi.  Couple of ways.  Here are two.

m = {
{82, 71, 62, 47}, 
{52, 96, 31, 36}, 
{94, 52, 86, 12}
}; 

Flatten[Map[Position[#1, Max[#1]] &, m]]

{1, 2, 1}

(* or *)

Flatten[Map[Ordering[#1, -1] & , m]]

{1, 2, 1}

-- 
HTH   :>)
Dana DeLouis
Mathematica 6, but reading 5.2 Help files



"haitomi" <tpnycity at yahoo.com> wrote in message
news:frclmj$rjp$1 at smc.vnet.net...
> Hello All,
> 
> 
> 
> t = Table[RandomInteger[{30, 99}], {i, 1, 3}, {j, 1, 4}]
> 
> max = Map[Max, t]
> 
> pos=Position[.........]
> 
> I stuck to find the position of each row.
> Example, if I run the table above they will generate for the following 3 X
4 matrix 
> {
> {82, 71, 62, 47},
> {52, 96, 31, 36},
> {94, 52, 86, 12},
>  
> }
> 
> and the the result of position I need will be
> 
> {1,2,1}
> 
> Anyone can help me.......
> 
> Thank you all,
> 
> Tomi
>




  • Prev by Date: Re: Re: Pi is not a real number?
  • Next by Date: RE: Intermediate Evaluation in FindMinimum
  • Previous by thread: help to find position location
  • Next by thread: Using SampleDepth and SampleRate for SoundNote data?