フィルターのクリア

Deleting specific rows in a matrix

1 回表示 (過去 30 日間)
Mohammad Juned
Mohammad Juned 2021 年 3 月 10 日
コメント済み: Mohammad Juned 2021 年 3 月 10 日
I want to delete rows that contain element of value 0
for example in the following matrix B
row 3, 4 ,5 contains a zero valued element. So I want to delete these rows and the resultant matrix would be 2*3 .
How can I remove these particular rows
120 150 200
250 300 350
420 450 0
0 100 400
450 0 420

採用された回答

ANKUR KUMAR
ANKUR KUMAR 2021 年 3 月 10 日
編集済み: ANKUR KUMAR 2021 年 3 月 10 日
A=[120 150 200
250 300 350
420 450 0
0 100 400
450 0 420]
index=find(nanmean(A==0,2))
A(index,:)=[]
Below is the output of index and A (after removing the rows having zero value)
index =
3
4
5
A =
120 150 200
250 300 350
  4 件のコメント
Mohammad Juned
Mohammad Juned 2021 年 3 月 10 日
ANKUR KUMAR I want to know why 2 is used in index=find(nanmean(A==0,2))
Mohammad Juned
Mohammad Juned 2021 年 3 月 10 日
Thank you ANKUR KUMAR

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by