フィルターのクリア

How to clear out rows of zeros in a matrix?

1 回表示 (過去 30 日間)
JamJan
JamJan 2018 年 7 月 25 日
コメント済み: JamJan 2018 年 7 月 26 日
Hello,
I am trying to get rid of all rows of zeros of this Matrix.
162 1
0 0
202 1
0 0
296 1
0 0
447 1
0 0
481 1
0 0
489 1
0 0
525 1
0 0
539 1
0 0
724 1
0 0
732 1
0 0
The output should be like this:
162 1
202 1
296 1
447 1
481 1
489 1
525 1
539 1
724 1
732 1
I have tried several ways, but I keep getting errors. Can anyone help me out?

採用された回答

Paolo
Paolo 2018 年 7 月 25 日
Let a be your matrix:
a(a(:,1)==0,:) = [];
  1 件のコメント
JamJan
JamJan 2018 年 7 月 26 日
Thank you!

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

その他の回答 (1 件)

LuKr
LuKr 2018 年 7 月 25 日
If A is your matrix:
A(A(:,1)==0,:)=[]

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by