MathGroup Archive 2008

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

Search the Archive

Re: Need Help to find max position location

On 3/13/08 at 8:51 PM, tpnycity at (haitomi) wrote:

>Write a function that returns a list that gives the column location
>of the largest integer in each row of a matrix (a list of lists) of
>random integers between 10 and 99.

>Example, for the following 3 X 4 matrix the result is


>{82, 71, 62, 47}, {52, 96, 31, 36}, {94, 52, 86, 12}}

The function you want is Ordering. Using this example with the
matrix assigned to the variable data, either

In[4]:= Ordering[#, -1] & /@ data // Flatten

Out[4]= {1,2,1}


In[5]:= (Ordering /@ data)[[All, -1]]

Out[5]= {1,2,1}

does the trick
To reply via email subtract one hundred and four

  • Prev by Date: Re: Numbering graphs and tables
  • Next by Date: Re: Using SampleDepth and SampleRate for SoundNote data?
  • Previous by thread: Need Help to find max position location
  • Next by thread: help to find position location