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 日

0 投票

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

1 件のコメント

Xi Wen Lim
Xi Wen Lim 2016 年 3 月 26 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2016 年 3 月 26 日

コメント済み:

2016 年 3 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by