Help in finding values between limits
4 次查看(过去 30 天)
显示 更早的评论
The brackets on the left are the coordinates of various points along the left black line. the red lines connecting the two black lines indicate the distance (in pixels).
I have the matrix A:
A = 3 0
2 2
2 1
3 3
which corresponds to the coordinate points I am looking for satisfying the equation of a line ( (x - a)^2 + (y - b)^2 = r^2 ).
Now, x & y correspond to the values in matrix A, while a & b correspond to the coordinate points (in brackets on the image) r is the pixel distance
An example using the point (0,2):
a = 0, b = 2, r = 2
if I implement this code:
B = A((A(:,1)-a).^2+(A(:,2)-b).^2==r^2,:);
I will get a matrix displaying the following:
B = 2 2
Now what I want to do is make sure that only 1 value is displayed in B using the condition that
a - r < x < a + r
&
b - r < y < b + r
where x and y are the values in B, I want this to be done to make sure that I am displaying only one the closest point which satisfies.
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!