How to select data inside a shape from a map figure
5 views (last 30 days)
Show older comments
Hello,
I want to manually select an area to filter out the rest. (Since the map cells have binary states, either occupied or free (1 or 0), I'd just have to set every cell ouside my selected area as free).
Say for example I have this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1031715/image.png)
If the shape was a rectangle, I would filter out anything to the left of x1 and to the right of x3 and (in this case because of the direction of the y axis) above y3 and under y1.
And that's what I already did (without the ginput, i set the limits on the script itself directly), I took my map, converted it to a matrix using occupancyMatrix and filtered out the rest.
However, I don't know how to do that with a shape that is not rectangular.
The problem is that my data is either map, or a matrix the size of my map (say 50x50 cells) with binary values. From searching a bit I fouund this: isinterior. With this I know how to create a polygon, and get data from inside this polygon, but the function needs both the polygon and x-coordinates and y-coordinates (or a 2 column matrix with one column for x and the other for y).
Would you have any indsight on that?
Thx in advance for any help,
2 Comments
Answers (0)
See Also
Categories
Find more on Directed Graphs 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!