Check for non ascii characters in matlab

I have a result string that sometimes contains non ascii values. These non ascii values ​​cause problems, so I need to check their presence in the result line.

I tried with these two methods

if (regexpi(result , ^\s\x{20}-\x{7e}))
display('non ascii');
end

and

if any(result  < 128)
else
display('non ascii');
end

but it didn’t work. Any help is appreciated.

0
source share
1 answer

small setting on above:

if all(result  < 128)
else
display('non ascii');
end

or

if any(result  > 127)
display('non ascii');
end
+1
source

Source: https://habr.com/ru/post/1616610/


All Articles