Undefined operator '>' for input arguments of type 'struct'.

조회 수: 2 (최근 30일)
Rabia Sikandar
Rabia Sikandar 2020년 1월 23일
답변: Steven Lord 2020년 1월 23일
I have a label code when am running it give me a error "Undefined operator '>' for input arguments of type 'struct'. on this code.Can any one help me to resolve this issue?gBB have the groundtruth value and MSER have the candidate of actual image.
gBB=val;
LabBB=[];
for i=1:length(mserBB(:,1))
Label=0;
for j=1:length(gBB(:,1))
if mserBB(i,1)>gBB(j,1) && mserBB(i,2)> gBB(j,2) && mserBB(i,3)< gBB(j,3) && mserBB(i,4)< gBB(j,4)
Label=1;
end
end
  댓글 수: 2
Steven Lord
Steven Lord 2020년 1월 23일
What do the following lines of code display?
whos gBB mserBB
check_gBB = isstruct(gBB)
check_mserBB = isstruct(mserBB)
At least one of check_gBB and check_mserBB will be true.
Rabia Sikandar
Rabia Sikandar 2020년 1월 23일
mser have candidate values and gBB have structure value how to compare these two?

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

채택된 답변

Steven Lord
Steven Lord 2020년 1월 23일
A struct array can be thought of like a filing cabinet. As an example, one of the drawers (fields) could be titled "taxDocuments", one is "insurance", still another is "utilityBills".
S = struct('taxDocuments', 1:10, 'insurance', magic(5), 'utilityBills', rand(3, 4, 6))
What would it mean to ask if 5 is greater than the filing cabinet? It could make more sense to ask if 5 was greater than part of the contents of one of the drawers in the filing cabinet:
if mserBB(1) > S.insurance(1) % if insurance is an array of numeric data

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by