string not recognized problem

I'm not sure if this title is approprite but I feel this is a very weird problem
there is a string 'Cfi' in the string text_tmp.mat, if I use the command:
strfind(text_tmp,'Cfi')
the result is 6, when I assign it to a parameter, such a 'loc_CA', it still works.
loc_CA=strfind(text_tmp,'Cfi')
but, when I put the command into a .m file and run this .m file, the result becomes empty:
load text_tmp
loc_CA=strfind(text_tmp,'Cfi')
is there any mistake with my operation?
Thanks!
Yu

6 件のコメント

Image Analyst
Image Analyst 2019 年 2 月 25 日
Exactly what is that last character? It's not a regular Western type letter. And exactly how did you save the .mat file?
Yu Li
Yu Li 2019 年 2 月 25 日
I read the character from a picture using 'ocr', them save it as text using 'save' function
Image Analyst
Image Analyst 2019 年 2 月 25 日
Again, exactly how did you save the .mat file? What is the line of code? If you told it to save it as text, then that may be the problem. Just tell it to save the variable as-is, in the native, proprietary .mat file format that MATLAB likes - essentially the default save with no option telling it to save as text.
Yu Li
Yu Li 2019 年 2 月 25 日
here is the command:
CA_tmp=ocr(I); %I is a image information obtained by I=imread()
text_tmp=CA_tmp.Text;
save text_tmp text_tmp
Thanks!
Yu
Stephen23
Stephen23 2019 年 2 月 25 日
編集済み: Stephen23 2019 年 2 月 25 日
"It's not a regular Western type letter"
It looks like a standard f-ligature to me:
When I searched for it using an online Unicode search engine it identified it as 'LATIN SMALL LIGATURE FI' (U+FB01).
Image Analyst
Image Analyst 2019 年 2 月 25 日
I figured it was some unicode character but by "regular", I meant it does not show up on my standard English keyboard. Most unicode characters don't. All I was able to do was to verify what Yu did, but I have no explanation for it. Do you?

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

質問済み:

2019 年 2 月 25 日

コメント済み:

2019 年 2 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by