find Euclidean distance without the for loop
Show older comments
I was finding the Euclidean distance using the for loop, I need help finding distance without for loop, and store into an array.
i'm storing the value in distance1 and distance2 variable. I need to convert it into an array.
Answers (1)
Andrei Bobrov
on 18 Jan 2019
Edited: Andrei Bobrov
on 18 Jan 2019
0 votes
distance12 = sqrt(sum(([centroid1,centroid2] - permute(dataset,[1,3,2])).^2,3));
Categories
Find more on Loops and Conditional Statements 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!