string comparison database and label comparison

2 ビュー (過去 30 日間)
AYUSH ANAND SAGAR
AYUSH ANAND SAGAR 2020 年 10 月 29 日
コメント済み: AYUSH ANAND SAGAR 2020 年 10 月 29 日
Operator '==' is not supported for operands of type 'table'.
Error in working_try_2 (line 98)
if(T(:,1)==string(label))
%%code
faceDetector=vision.CascadeObjectDetector;
while true
img_again=getsnapshot(video);
pause(2);
bbox=step(faceDetector,img_again);
if(sum(sum(bbox))~=0)
es=imcrop(img_again,bbox(1,:));
es=imresize(es,[227 227]);
label=classify(myNet1,es);
image(es);title(char(label));
% comparion of the found image with the student database
if(T(:,1)==string(label))
disp(strcat('Student=',string(label)));
disp('Found');

回答 (1 件)

Sudhakar Shinde
Sudhakar Shinde 2020 年 10 月 29 日
%use Compare strings
strcmp(T(:,1),string(label))
%or Compare strings (case insensitive)
strcmpi(T(:,1),string(label))
Check this: strcmpi or strcmp
  1 件のコメント
AYUSH ANAND SAGAR
AYUSH ANAND SAGAR 2020 年 10 月 29 日
% comparion of the found image with the student database
if(strcmpi(T(:,1),string(label)))
disp(strcat('Student=',string(label)));
disp('Found');
col={'ID','Attendance'};
dat={string(label),'P'};
unitable('columnname',col,'Data',dat);
end
it doesnt disp the statements under the if condition and directly goes to the next condition

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by