MATLAB: Table delete rows with specific value in column

deleterowstable

I will ask my question by an example. I have a table, looks like:
T = table();
T.c1 = [1 2 1 1 1 2 1 2 2 ]';
T.c2 = ['a' 'a' 'a' 'b' 'b' 'a' 'a' 'a' 'b']';
T.c3 = ['a' 'b' 'a' 'a' 'b' 'a' 'b' 'a' 'a']';
T.c4 = [1 1 1 2 1 2 1 3 2 ]';
I want to delete all the rows (The complete row) that have 'b' in c2. Also, I want to delete all rows where c4 > c1. How can I do this efficiently?

Best Answer

T = table();
T.c1 = [1 2 1 1 1 2 1 2 2 ]';
T.c2 = ['a' 'a' 'a' 'b' 'b' 'a' 'a' 'a' 'b']';
T.c3 = ['a' 'b' 'a' 'a' 'b' 'a' 'b' 'a' 'a']';
T.c4 = [1 1 1 2 1 2 1 3 2 ]';
T(ismember(T.c2,'b'),:)=[];
T(T.c4>T.c1,:)=[];