using conditional operators for string matching
古いコメントを表示
J=im2uint8(im);
ocrResults = ocr(J)
recognizedText = ocrResults.Text;
TF=contains(recognizedText,'Axis Bank', 'IgnoreCase', true);
bboxes = locateText(ocrResults, 'Axis Bank', 'IgnoreCase', true);
Iocr = insertShape(J, 'FilledRectangle', bboxes);
figure;
imshow(Iocr);
disp('Axis Bank')
I am new to Matlab so I appreciate your patience regarding my noviceness.
I need to check if an OCR-ed string contains a substring and I need to check multiple substrings automatically. However I am unable to use any conditional operator as I do not understand how to use the logical output I am getting from
TF variable
Kindly assist me with this problem.
Thank you.
9 件のコメント
Alex Mcaulley
2019 年 5 月 8 日
What is the question? see this
Siddesh chaudhary
2019 年 5 月 8 日
Siddesh chaudhary
2019 年 5 月 8 日
Geoff Hayes
2019 年 5 月 8 日
Siddesh - you have your if/elseif block set up as
if TF == 1
% some code
elseif TF == 1
% some other code
end
The elseif block will never evaluate since it has the same condition as the first block. Perhaps you mean to do something like
if TF == 1
% some code
% TF = ...;
end
if TF == 1
% other code
end
Since in the if block you re-assign the value of TF.
Or perhaps
if TF
% some code
end
"if TF==1" is redundant. TF is a logical that is either true (1) or false (0).
@ Siddesh , select all of your code (cltr + a) and then auto-indent (ctrl + i). The indentation will help you to catch these types of issues.
Siddesh chaudhary
2019 年 5 月 8 日
Siddesh chaudhary
2019 年 5 月 8 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Event Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
