How can I remove an entire row of zeros in a matrix?

2 次查看(过去 30 天)
If I have a matrix like this one:
45 23 54
0 0 0
9 3 32
How can I remove the second row and obtain this matrix?
45 23 54
9 3 32

采纳的回答

David Fletcher
David Fletcher 2018-3-8
编辑:David Fletcher 2018-3-8
a=[45 23 54;0 0 0;9 3 32];
zero=a==0;
ind=all(zero,2);
a(ind,:)=[]
Presumably the entire row has to have zero in every column for it to be removed

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by