I'a having a problem with the loop.I am doing face recognition in ANFIS. I am using 3 statistical features for 1 image.I already train and test the network.Output for the network in 1 image is:
output=0.0014
0.2992
-0.8178
then, i have to subtract the output with each value in the database so that when the answer is [0.00 0.00 0.00]', it's mean i already find the exact match.
The database is:
database=0.0014 0.5208 -0.0000
0.2992 0.2358 -0.0003
-0.8178 0.4429 -0.0077
0.0018 -0.0000 0.0008
-0.0000 -0.0000 0.0131
0.0000 0.0005 0.4585
-0.0020 0.9925 1.0074
-0.0001 0.9557 0.9999
-0.0035 0.6546 0.9882
1.0399 0.9322 0.5067
0.6241 0.9999 1.0000
0.5647 1.0175 0.9999
0.9990 1.0006
1.1715 0.9999
0.9075 0.9778
i am using for loop to do the process:
[l,m]=size(database);
for i=1:1:m
for j=1:1:l
diff=anfis_eval(j,i)-anfis_eval1(j,1);
if(diff==0)
ans=i:
end
end
end
I manage to get the exact match, my problem now is that what if there is no exact
match and I want to find the smallest different.I think i should put the 'else'
condition so that if the answer is not zero than I shoul go to another condition.
[l,m]=size(database);
for i=1:1:m
for j=1:1:l
diff=anfis_eval(j,i)-anfis_eval1(j,1);
if(diff==0)
ans=i:
else
?????
end end end
Now, I don't know how to find the smallest different.Can somebody help me?