find values around a given row value

조회 수: 5 (최근 30일)
MacKenzie
MacKenzie 2013년 11월 25일
댓글: Walter Roberson 2017년 10월 14일
I have a 2 column matrix where I have a row of interest. i.e.
A =
2.5000 2.3500
2.5600 3.3300
2.4500 3.1000
etc....
and I want to find say 100 rows past the row of interest (2.5 2.35) (i.e. down the matrix). Is there a function for this? thanks.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 25일
편집: Azzi Abdelmalek 2013년 11월 25일
idx=find(ismember(A,[ 2.5000 2.3500],'rows'),1)
out=A(idx+1:idx+100,:)
  댓글 수: 6
MacKenzie
MacKenzie 2013년 11월 25일
Ah! thanks SO much!
Walter Roberson
Walter Roberson 2017년 10월 14일
QIANG SUN comments to Azzi:
great!

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

추가 답변 (1개)

Youssef  Khmou
Youssef Khmou 2013년 11월 25일
you can use minimum absolute value as the following :
% data generation
p1=2.5;p2=2.35;
A=ones(600,2);
A(:,1)=A(:,1)*p1;
A(:,2)=A(:,2)*p2;
A=A+randn(size(A); % additive noise
%processing
eps=0.02;
B(:,1)=abs(A(:,1)-p1);
B(:,2)=abs(A(:,2)-p2);
Result=B(B<eps);

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by