Columns with at least one zero element
Show older comments
Hi,
If I have a matrix with random dimension mxn , how can I detect a column which have at least one zero element?
Thank you
Accepted Answer
More Answers (2)
Jos (10584)
on 16 Jun 2014
Let M be your mxm matrix:
tf = any(M==0,1) % true for columns with at least 1 zero
C = M(:,~tf) % columns with no zeros
dpb
on 16 Jun 2014
idx=~all(M);
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!