Help in finding values between limits
조회 수: 1 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145203/image.jpeg)
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!