필터 지우기
필터 지우기

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 CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by