Let:
Where D is the dimensions of the matrices. I will compute each E(i,j) and then populate the resulting matrix. This is what I tried to do. A(i) and B(j) are column vectors of 2 matrices. So A(k,i)-B(k,j) means that I am taking the difference between two column vectors but I have to do it for each row which is represented by k.Then square it and sum them up and finally take the sqrt to out put E(i,j). My code doesn't work and I tried for few days. I am new to Matlab as well as programming. Please excuse if the format of overflow is off.
function E1 =emo(X,Y,i,j)
A = X(:,i);
B = Y(:,j);
function L2 = dis(A,B)
n = size(A);
for i = 1:n
C(i,1) = (A(i,1)-B(i,1))^2;
end
d = sum(C);
L2 = sqrt(d);