필터 지우기
필터 지우기

How do I delete a row based on the based of the first column cell?

조회 수: 1 (최근 30일)
For example. If I wanted to delete each row that contained the number 10 in the first column, how can I do that. Essentially is acts like a filter and deletes all the rows with that value.

채택된 답변

the cyclist
the cyclist 2012년 6월 28일
If x is your array,
x(x(:,1)==10,:) = [];
  댓글 수: 2
Brady Thom
Brady Thom 2012년 6월 28일
편집: Brady Thom 2012년 6월 28일
Thank you for the speedy response! If you have a second, maybe a little description of what the notation does? I am just trying to learn and be more self sufficient
Ryan
Ryan 2012년 6월 28일
편집: Ryan 2012년 6월 28일
x(:,1) == 10 returns a logical vector (1 for a 10, 0 otherwise). He's searching all rows (:,) and just the first column (,1).
x(logical vector,:) is locating the row's that have the 10 in the first column from before (dictated by the x(:,1) == 10) and saying select all the columns (,:) of those rows and then delete them by setting them equal to [].

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by