i'm trying to retrieve an index to a variable and then using that variable to access the list.

The (simplified) code:

myList = {1, 5};
minElement = Position[myList, Min[myList]];

I get this error:

Part::pkspec1: The expression {{1}} cannot be used as a part specification.

The whole idea is to access other lists as well using the minElement index.

This seems like an easy question but i just can't find help about it.

  • 2
    $\begingroup$ The results of Position are to be used with Extract. E.g. Extract[myList, minElement] $\endgroup$
    – Edmund
    Aug 7, 2017 at 3:04
  • $\begingroup$ Thanks Edmund, this seems to work! $\endgroup$
    – Emiliano
    Aug 7, 2017 at 3:08
  • $\begingroup$ @Emiliano I've found that frustrating, too. As @Edmund pointed out, Extract is the way to go. But in some cases I've gone for myList[[#]] & @@@ minElement instead, which gives the same answer. $\endgroup$ Aug 7, 2017 at 3:33
  • $\begingroup$ If you just need the position of the minimum, you could use Ordering[]. $\endgroup$ Aug 7, 2017 at 4:02
  • $\begingroup$ 115226 $\endgroup$
    – Kuba
    Aug 7, 2017 at 7:02

1 Answer 1


It's a formatting problem. maybe use, in a non-elegant way

myList = {1, 5};
minElement = Position[myList, Min[myList]][[1]][[1]];

which returns


as expected


Not the answer you're looking for? Browse other questions tagged or ask your own question.