Delete rows from matrix?

1 次查看(过去 30 天)
I have a bunch of data:
[1 1
0 0
2 6
3 5
5 55
6 56
0 0
7 69
11 2
0 0 ]
I want to remove all rows with values 0 in the first column. How should I do this? The above is just a part of the data. The data has way more rows than that.

采纳的回答

Stephen23
Stephen23 2016-3-26
编辑:Stephen23 2016-3-26
Just use some basic MATLAB logical indexing:
>> X = M(M(:,1)~=0,:)
X =
1 1
2 6
3 5
5 55
6 56
7 69
11 2

更多回答(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