using conditional operators for string matching
Afficher commentaires plus anciens
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 commentaires
Alex Mcaulley
le 8 Mai 2019
What is the question? see this
Siddesh chaudhary
le 8 Mai 2019
Siddesh chaudhary
le 8 Mai 2019
Geoff Hayes
le 8 Mai 2019
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
le 8 Mai 2019
Siddesh chaudhary
le 8 Mai 2019
Réponses (0)
Catégories
En savoir plus sur String dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
