[Date Index] [Thread Index] [Author Index]
Re: message 50001?
"1.156" <rob at pio-vere.com> wrote in message news:<cfcqbg$42j$1 at smc.vnet.net>... > Mathematica wizards, I've managed to cripple together code to do something that > I feel must be doable more easily and/or faster. > > S is a list of reals containing a signal with a prominent peak in > amplitude. I simply want to find the index of the peak (x, the number of > entries into the list where the peak occurs). Here's what I did. > > > For[i = 1, S[[i]] ? max[S], i++, x = i]; > > Can some suggest a better way, especially one not using a For loop? > > Thanks, Rob How about the following Last@Ordering[S] or Position[S, Max[S]] K. Z.