MATLAB: Coneptually question: How to extract certain rows if column conditions are met

beginnercell arrayslogical indexingMATLABtable

This is more of a conceptual question so I do not have an exact table I can share. So I made up a quick one.
State Residence Pets Cars
__________ ______ ______
1 California 0 1
2 California 0 1
3 Texas 1 0
4 Utah 0 0
5 Oregon 1 1
So let's say I have a table with 3 columns. And I want to extract the rows if the column conditions I seek are met. So for example, I want the rows of people who said they have only 1 pet. So the result would be
output:
State Residence Pets Cars
__________ ______ ______
3 Texas 1 0
5 Oregon 1 1
How would I go around doing that? I understand logical indexing would be used of course but I am not sure how to use it here? Which matlab functions would be useful here since I am not quite familar with cell arrays.
Thanks!

Best Answer

Let T be the table you have.
idx = T.Pets==1 ;
T(idx,:)