I have a list and I know the maximum value of that list by using Max[list]
. The thing is I want to find out the index number of this list that corresponds to this value. For example:
list={9999,2,3,4,5,....,1}
Max[list]
(*9999*)
c= f[Max[list]]
where the function f
gives me the index of list
that corresponds to the value Max[list]
which is 9000
in this case. Maybe using Pick
somehow. Since I am dealing with frequency spectrum, and I know that the maximum is near a low frequency, I would like for the function to just check the first few or so instead of all elements in list
.
Position[]
? $\endgroup$f = {Max[#], Flatten[Position[#, Max[#]]][[1]]} &;
where the output is in the form(***{ max value, index in list} ***)
$\endgroup$