how to delete zeros from a matrix

2 次查看(过去 30 天)
hi there,
say i have a matrix: set1 =
1 3
0 0
1 5
0 0
1 8
0 0
1 16
how do i get rid of the zero rows, so it looks like:set1 =
1 3
1 5
1 8
1 16
tnx
SN

采纳的回答

Image Analyst
Image Analyst 2013-2-18
Try this:
m = [...
1 3
0 0
1 5
0 0
1 8
0 0
1 16]
zeroRows = ~all(m, 2)
m(zeroRows,:) = []

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Text Data Preparation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by