how to check if the row of the matrix equal zero or not
3 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!