4
$\begingroup$
SeedRandom[1];
m = RandomInteger[1, {10, 2}]
Position[m, u_ /; u != {0, 0}]

{{1, 1}, {0, 1}, {0, 0}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, 
 {0, 1}, {1, 1}}

{{1}, {2}, {4}, {5}, {9}, {10}, {}}

I want to find where the pairs are different from {0,0}. What is the last emtpy bracket?

$\endgroup$
  • $\begingroup$ The empty brackets indicate that the entire expression matched the pattern, see the 5th point in the details section of the documentation of Position $\endgroup$ – Lukas Lang Feb 23 at 9:40
9
$\begingroup$
Position[m, u_ /; u != {0, 0}, 1]

{{1}, {2}, {4}, {5}, {9}, {10}}

Count[m, Except[{0, 0}]]

6
|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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