How to remove some values in a matrix?

조회 수: 1 (최근 30일)
ruik zhang
ruik zhang 2018년 7월 28일
댓글: ruik zhang 2018년 7월 28일
Hello,
For example I have a matrix
[66 62;
64 70;
62 100];
In the first column, I just want keep those values between 60 and 65, in the second column, I want to keep the values between 61 and 70, if not those case, I want to delete those rows. namely the new matrix will be [64 70];

채택된 답변

Walter Roberson
Walter Roberson 2018년 7월 28일
mask = A(:,1) >= 60 & A(:,1) <= 65 & A(:,2) >= 61 & A(:,2) <= 70;
B = A(mask,:);
  댓글 수: 1
ruik zhang
ruik zhang 2018년 7월 28일
Appreciated and it works well.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Author Block Masks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by