Hi,
I need help, I have 2 patches and I need to get the similarity between these patches and put the similarity values in matrix A.
So, matrix A will be 2*2.
I want for loop to shorten my code.
My code is
A = zeros ([2 2]);x1 = double(patches {1,1});x2 = double(patches {2,1});% Patch #1
x = double (reshape(x1,[],1));y = double (reshape(x1,[],1));Cs = getCosineSimilarity(x,y);A(1,1) = Cs;x = double (reshape(x1,[],1));y = double (reshape(x2,[],1));Cs = getCosineSimilarity(x,y);A(1,2) = Cs;% Patch #2
x = double (reshape(x2,[],1));y = double (reshape(x1,[],1));Cs = getCosineSimilarity(x,y);A(2,1) = Cs;x = double (reshape(x2,[],1));y = double (reshape(x2,[],1));Cs = getCosineSimilarity(x,y);A(2,2) = Cs;
Best Answer