MATLAB: How to check if the row of the matrix equal zero or not

if statementmatlab functionmatrix

Hi I would like to ask, how can I check each row of a matrix if it zero or not?? I wrote this program but it doesnot work. I need If the row equal zero do something else delete that row and do another thing.
m=[1 2; 2 3; 0 0 ; 9 9]
if m(:,2)==0 % check if one row is zero
m1=2+m % add 2 to that row
else
k=m(all(m==0,2),:)=[] % delete that row and create new vector (k)
end

Best Answer

k=m;
k(all(m==0,2),:)=[] % delete that row and create new vector (k)