I have a list a, which consists of some positive real numbers. I want to find the indices of elements which are larger than 10 in list a, and put the indices into another list index. The following is my code:
a = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19}; index = {}; For[i = 1, i <= Length[a], i++, If[a[[i]] > 10, index = Append[index, i]] ] index The output is
{6, 7, 8, 9, 10} which is correct. Is there a better way to find the list index? For example, do not use the For loop. Thank you very much in advance.
Position[a, _?(# > 10 &)]. If you start at 1, if 0 just subtract 1 $\endgroup$