Cropping a range of Coordinates from a bigger data set
Mostra commenti meno recenti
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.
Risposta accettata
Più risposte (2)
Image Analyst
il 31 Lug 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.
1 Commento
John
il 1 Ago 2012
Walter Roberson
il 1 Ago 2012
XY( XY(:,1) >= 500 & XY(:,1) <= 1500, XY(:,2) >= 0 & XY(:,2) <= 1000)
1 Commento
John
il 1 Ago 2012
Categorie
Scopri di più su Resizing and Reshaping Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!