Cropping a range of Coordinates from a bigger data set
Show older comments
I have an x-y coordinates data set measuring [0 2000 0 4000]. I wish to extract the coordinates in the range [500 1500 0 1000]. How do I do this? Thanks.
Accepted Answer
More Answers (2)
Image Analyst
on 31 Jul 2012
I"m not sure what measuring [0 2000 0 4000]" means. This is very imprecisely worded. I'm guessing that you have a 1-dimensional array where you have the 2001 x coordinates first, followed by 4001 y coordinates. I'm not sure why you have more y coordinates than x coordinates though. If so, I'd do this:
index1 = 500;
index2 = 1500;
xCoordinates = xy(index1:index2);
index1 = 2001 + 1; % Index of the first y coordinate.
index2 = 2001+1000; % Index of the 1000th y coordinate.
yCoordinates = xy(index1:index2);
If you mean something different then you'd need to explain better what you want.
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!