How do I calculate norm with a for loop?
Show older comments
So I have a set of data in a matrix represented as x y coordinates and another set of data as well with the same column dimensions but different row dimensions. How can I create a for loop to take the norm of each data point from each matrix to get the distance between every single coordinate point? In other words say I have matrix A= [1 2; 3 4; 5 6] and B = [9 8; 7 6; 5 4; 3 2; 1 0] where I want to take the norm of 1,2 and 9,8, 1,2 and 7,6 1,2 and 5,4 and so on.
Answers (1)
Matt J
on 2 May 2022
pdist2(A,B)
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!