Matlab Function to produce data from points
Show older comments
Hi
The question i have is say i have a starting position (x and y) (2D)
following that i have 2 colums of randomly generated points to act as x and y (rand(20,1),rand(20,1) for other coordinates
function inputs(x,y,c1,c2) if that makes sense (where c1= rand(20,1 and c2= rand(20,1)
with this infomation im looking to calcualte some data resulting in from the starting position the closest point from the c1 and c2 and from that positon the next one and next one until i find a 'path' that would display for example (1,5,2,6,9,17,13...) to find the shortest distance between all points
is there any possibility to do this?
any advice appreciated
2 Comments
Jan
on 25 Mar 2021
The concatenation of the shortest paths is not necessarily the shortest path over all points, is it?
But of course it is possible to do, what you are asking for. Use pdist() and sort the values.
Samuel Shlong
on 25 Mar 2021
Answers (0)
Categories
Find more on Matrix Indexing 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!