필터 지우기
필터 지우기

How to analyse this data set?

조회 수: 1 (최근 30일)
Mo Ba
Mo Ba 2017년 5월 4일
편집: KSSV 2017년 5월 4일
Hello experts,
I have some data points and can easily plot them on a figure in MATLAB. For some reason, I need to find out what data points are located inside some rectangle areas as can be seen in attached picture. In this picture, black dots represent my data points and red rectangles represent mentioned areas. In this example, how can I search into my data points and see whether they belong to any rectangle or not? I need to have a list of all members (data points) for each rectangle. I hope I explained my problem clearly. Any idea and advice is appreciated.

채택된 답변

KSSV
KSSV 2017년 5월 4일
편집: KSSV 2017년 5월 4일
doc inpolygon
N = 30 ;
[X,Y] = meshgrid(1:N,1:N) ;
plot(X,Y,'.k','markersize',10) ;
%%polygon coordinates
Rect = [ 8.5369 23.4840
17.4539 23.4840
17.5230 16.7493
7.6382 16.4869
8.5369 23.4840] ;
hold on
plot(Rect(:,1),Rect(:,2),'r');
%%get points inside the polygon
idx = inpolygon(X,Y,Rect(:,1),Rect(:,2)) ;
%%points inside polygon
xi = X(idx) ; yi = Y(idx) ;
plot(xi,yi,'ob')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by