필터 지우기
필터 지우기

Compare output with each row and column from a table.

조회 수: 1 (최근 30일)
Zubia Mansoor
Zubia Mansoor 2019년 5월 6일
댓글: Zubia Mansoor 2019년 5월 7일
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

답변 (1개)

Erivelton Gualter
Erivelton Gualter 2019년 5월 6일
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
Zubia Mansoor
Zubia Mansoor 2019년 5월 7일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by