Compare output with each row and column from a table.

1 vue (au cours des 30 derniers jours)
Zubia Mansoor
Zubia Mansoor le 6 Mai 2019
Commenté : Zubia Mansoor le 7 Mai 2019
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

Réponses (1)

Erivelton Gualter
Erivelton Gualter le 6 Mai 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 commentaire
Zubia Mansoor
Zubia Mansoor le 7 Mai 2019
Thanks for replying.
Sorry for inconvenience I might not be specific, I have a dataset of min and max RGB values of diffirent images. I wanted to check whether my output lies within dataset. For this purpose I use commend
health{1,3}
In which I specify in which row(1) and column(3) it should lie. I needed a code which automaitically check whether the output exists in dataset or not without specifying speccific row and column.
Thanks a lot.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by