MATLAB: Finding the percentage of concordance

percentage

  • Hello, I want to calculate the percentage of image not presented to image is presented *
function ham_dis = rec_test(train,impostures)
ham_dis = [];
for g=1:5
for j=1:339
ham_dis(j,:)= sum(sum(abs(impostures(g,:)-train(j,:))));
if (ham_dis(j,:) < 7374)
disp('image is present');
else
disp('image not present');
end
end
end
end
thanks

Best Answer

I have no idea what "the percentage of image not presented to image is presented" means.
Is there a problem with your code? Can't you just count the number?
Before the loop
numberPresent = 0;
In the loop:
if (ham_dis(j,:) < 7374)
disp('image is present');
numberPresent = numberPresent + 1;
else
disp('image not present');
end
After the loop:
percentage = 100 * numberPresent / (5*339);