Compare output with each row and column from a table.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Erivelton Gualter
el 6 de Mayo de 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
1 comentario
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!