MATLAB: Does textread fails to read files which contain non-ASCII characters in their filename on MAC operating system

MATLABnon-asciitextreadtextscan

I tried running following simple function which creates a file which contains non-ASCII character in its filename. I wrote some text in it and tried to read it back using "textread" but while doing so I received error saying file was not found.
I tried following code:
 
filename = char([65 181 66]);
fid = fopen(filename, 'w'); fprintf(fid, '%s\n', 'hello'); fclose(fid);
textread(filename, '%s')
I received following error after executing code:
 
Error using dataread
File not found or permission denied.
Error in textread (line 168)
[varargout{1:nlhs}]=dataread('file',varargin{:}); %#ok<REMFF1>
 
Why does textread fail while working with files which contain non-ASCII characters in their filename? Is there any workaround I can use to read these files?

Best Answer

As mentioned in the documentation of 'textread' for MATLAB, it is recommended to avoid using 'textread'  by using 'textscan' instead. The issue  seen can be resolved by using 'textscan' instead of 'textread'. Please refer to the attached demo script. The only difference between the scripts is, the attached script uses 'textscan' to read from the file instead of 'textread'.