Compare output with each row and column from a table.
1 view (last 30 days)
Show older comments
I have a table consisting of 28 rows and 8 columns. I want to check whether my output matched with any value from my table. The following code gives me correct output but in this case I have to specify row and column. But I needed a code which check automatically, so I can use same code on various images.
Can anyone help me?
if(minR == health{1,3})
if (maxR == health{1,6})
if(minG == health{1,4})
if (maxG == health{1,7})
if(minB == health{1,5})
if (maxB == health{1,8})
figure; imshow(A); title('HEALTHY')
end
end
end
end
end
else
figure; imshow(A); title('INFECTED')
end
0 Comments
Answers (1)
Erivelton Gualter
on 6 May 2019
You might create a function to perform this task, an dyou call it as many times you desire.
% function return status
function out = getStatus(A, minR, maxR, minG, maxG, minB, maxB, health)
out = [];
if(minR == health{1,3})
if (maxR == health{1,6})
if(minG == health{1,4})
if (maxG == health{1,7})
if(minB == health{1,5})
if (maxB == health{1,8})
figure; imshow(A); title('HEALTHY')
out = 1;
end
end
end
end
end
else
figure; imshow(A); title('INFECTED')
out = 0;
end
end
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!