Pick

Pick[list, sel]
picks out those elements of list for which the corresponding element of sel is True.

Pick[list, sel, patt]
picks out those elements of list for which the corresponding element of sel matches patt.

DetailsDetails

  • sel can be a nested list of any depth.
  • Pick[list, sel, patt] picks out those for which matches patt.
  • Depending on the arrangement of elements matching patt in a nested list sel, Pick may return a ragged array.
  • The heads in list and sel do not have to be List.
  • Pick works with SparseArray objects.
New in 5.1
New to Mathematica? Find your learning path »
Have a question? Ask support »