This question already has an answer here:

I have the following array of numbers:

a = {{0, 2, 5}, {3, 5, 1}, {4, 0, 5}, {8, 3, 4}, {0, 8, 6}}; 

then I make a list of the first row with

r = a[[All, 1]]

I would like to take just the elements where the first number is equal to 0. I have tried with

TakeWhile[a, r = 0]

but I didn't get a result.

Any suggestions?


marked as duplicate by Kuba, m_goldberg, bbgodfrey, Sjoerd C. de Vries, Dr. belisarius Mar 5 '15 at 15:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Dr. belisarius Mar 5 '15 at 14:19
  • 1
    $\begingroup$ a[[All, 1]] isn't the first row, it's the first column $\endgroup$ – Sjoerd C. de Vries Mar 5 '15 at 14:54

You might try

(* {{0, 2, 5}, {0, 8, 6}} *) 
  • $\begingroup$ @GregorioMartinez: You're most welcome. Please also accept my answer, if it fits your needs. $\endgroup$ – Jinxed Mar 5 '15 at 18:18

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