I have plot circle according to the grid points and I have a problem to extract the points within each circle. This is my coding..
How should I extract the points from each circle. and save it in separate files according to the grid points. anyone can help?
clc;clear;% Number of Points
numPoints = 5475;data = load('Sample.txt');x = data (:,2);y = data (:,1);z = data (:,3);%
plot(x, y, '.r');% Make circle.
grid = load('Grid025.asc');[row,column]=size(grid);x0 = grid (:,2);y0 = grid (:,1);R = 0.09;% Plot circle
for i=1:rowpos = [x0(i)-R, y0(i)-R, 2*R, 2*R];rectangle('Position', pos, 'Curvature',[1 1]);hold on;% Determine how many points are in the circle .
count(i) = sum(((x-x0(i)).^2+(y-y0(i)).^2<=R^2));listC = count.';%Extract Data in Each Circle
distances = sqrt((x-x0(i)).^ 2 + (y-y0(i)).^ 2);InsideCircle = distances <=R;xS = x(InsideCircle); % Selected Lon
yS = y(InsideCircle); % Selected Lat
zS = z(InsideCircle); % Selected h
end
Best Answer