在matlab中检查非ascii字符 [英] check for non ascii characters in matlab
本文介绍了在matlab中检查非ascii字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i有一个有时包含非ascii值的结果字符串.这些非ascii值会引起麻烦,因此我需要检查结果字符串中是否存在它们.
i have a result string that sometimes hold non ascii values. These non ascii values cause trouble so i need to check for their presence in the result string.
我尝试了这两种方法
if (regexpi(result , ^\s\x{20}-\x{7e}))
display('non ascii');
end
和
if any(result < 128)
else
display('non ascii');
end
但是没有用.任何帮助是极大的赞赏.
but it didn't work. Any help is greatly appreciated.
推荐答案
对上述内容进行细微调整:
small tweak to the above:
if all(result < 128)
else
display('non ascii');
end
或
if any(result > 127)
display('non ascii');
end
这篇关于在matlab中检查非ascii字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文