Hi again everybody,
I have pairs of coordinates [x,y] which I can use to plot a nice figure of lines. However, I need to use the coordinates between these two points.
I either need to find the coordinates between them, or I need to plot a line between them using plot or some other function and then extract the x,y values of the line (this info must be stored somewhere right?).
interp1 has been suggested for another question but I get an error when trying to use this - possibly because the distance between the two points is a decimal? This is the error:
Error using griddedInterpolant The point coordinates are not sequenced in strict monotonic order.
The same goes for using linspace to create a series of coordinates, the number of coordinates I would need it to create would be a decimal, which it can't do. This is the error:
Warning: Integer operands are required for colon operator when used as index
Thank you for any help,
No products are associated with this question.
I answered my own question again:
In my case I had the option of changing the coordinates slightly - I wasn't trying to find the coordinates of a fixed line, so this probably isn't much use to anyone.
Basically I made the distance of my line a whole number, by altering my x value slightly (I used Pythagoras' theorem to find the distance, then round it and then work out the new x value I would need to get this distance).
Once my distance was a whole number I used linspace to create a vector of x and y values between my points i.e. linspace(xvalue1,xvalue2,distance_between_them) and voila!, I have the coordinates I needed.