Find differences in a set of points without a for loop
조회 수: 8(최근 30일)
I a vector of numbers that I am trying to find the differences between each element in the vector without a for loop. Below is a code example. Is there a more efficient way to execute this code without a for loop?
x = rand(20,1);
diff = zeros(length(x),length(x));
for ix = 1:length(x)
for iy = (ix+1):length(x)
diff(ix,iy) = abs(x(ix) - x(iy));
Mehri Mehrnia 2022년 5월 19일
I have the question to find all pair-wise difference in a group without loop!
My array in scale of milions!