Below is my code, I want to calculate the hamming distance between my "inp" and each row in the a matrix and save these hamming distances in different variables.:
a=[1 1 1 1;1 0 1 1;1 1 0 0; 1 0 0 1]
inp=[0 1 0 1]
for i = 1:4
D=a(i,:);
('dist%d',i)=pdist2(inp,D,'hamming')
fprintf('\n')
i=i+1;
end
This code is not working and I know that the ('dist%d',i) is the part that is wrong. However, I can't solve it. What i want to do is get the results as follows: dist1= , dist2= , dist3= , dist4= .And this is why I tied it with the "i" because it is my loop. Any ideas how can this be solved.