I have a matrix where each row of numbers represent values for a person.... person =
98 206 35 114
60 206 28 52
100 210 31 116
69 217 26 35
88 213 42 100
(The numbers I have here aren't really the numbers that I have) I want to compare array person1 = [93 208 34 107] with each row of the person. I find out which array is bigger than the other, then I divide the smaller by the larger. If the quotient is greater than or equal to 0.85 then there is a match and the name of the person will print to the screen. Should I use a loop and several if/else statements like what I have below? I'm sure there is a better method to doing this.
for z = 1:5
if z == 1
a = max(person(z,:),person1);
b = min(person(z,:),person1);
percent_error = b/a;
if percent_error >= 0.85
title('Match,its Cameron!','Position',[50,20,9],'FontSize',12);
end
elseif z ==2
a = max(person(z,:),person1);
b = min(person(z,:),person1);
percent_error = b/a;
if percent_error >= 0.85
title('Match,its David!','Position',[50,20,9],'FontSize',12);
end
elseif z == 3
a = max(person(z,:),person1);
b = min(person(z,:),person1);
percent_error = b/a;
if percent_error >= 0.85
title('Match,its Mike!','Position',[50,20,9],'FontSize',12);
end
.
.
.
so on...
end
end