Assigning variables based on corresponding grid cells traversed by a line on a 2D grid plot

1 次查看(过去 30 天)
Hi,
Assuming I have a 3x3 grid as follows, where the blue line is connecting two points (the red crosses):
How would I code for MATLAB to return each grid cell passed through by this line i.e. to return the variables A, B, E and F?
I was thinking of coding along the lines of "if the line passes through coordinates in the x value range of ... and y value range of ... then return A" and so on for each grid cell.
If anyone could suggest how to code this considering it passes through a line simply formed by plotting two sets of coordinates, it would be much appreciated.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by