I need help with the following code:
N = size(data1,1)/2;
c=NaN((size(data1,1)/2),size(data1,2));
kk=0;
for ii=1:2:((size(data1,1)/2)-1)
c(kk+(1:N-ii),:)=bsxfun(@minus,data1(ii,1:end),data1(ii+1,1:end))
kk=kk+N-ii;
end
The code is attempting to take the difference between all column values between two rows, then get the difference between the next two different rows and so on. Example:
matrix a
1 2 3 4
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
matrix b
3 3 3 3
4 4 4 4
4 4 4 4