Hello all, I am using following code to estimate pairwise angle between for a vector. Where the angle should be between 0 to 2*pi. I am able to predict the angle. But I need your advise on implementing this two for loops. This is slowing the code. Looking forward for your attention. In the code, XYdata is a n x 2 matrix representing the Cartesian coordinates of individual point [xi, yi]. I presume this slow is because of two FOR loops.
for i2 =1:length(XYdata_new)
for j2 = 1:length(XYdata_new)
angle_ij(i2,j2)= Angle360(XYdata_new(i2,1), XYdata_new(i2,2), XYdata_new(j2,1),XYdata_new(j2,2));
Thanks in advance.