I found strange behavior in the matlab fileattrib
function on Windows. For certain file names, it incorrectly identifies the file as a hidden system folder.
To test it, download this file (the file is empty, this is important only for the file name):
https://docs.google.com/file/d/0B9BeckFuQk1bNHY3T0NKaFpxbUU/edit?usp=sharing
Put the file in an empty folder (I use "c: \ temp") and try the following:
fileattrib('c:\temp\*')
If your Matlab is like mine, it will give you this wrong result:
ans = Name: 'c:\temp\?aaa.txt' archive: 1 system: 1 hidden: 1 directory: 1 [...]
Now rename the file name by deleting the first character and try again. He will say correctly
ans = Name: 'c:\temp\aaa.txt' archive: 1 system: 0 hidden: 0 directory: 0 [...]
I saw this behavior in Matlab R2010b and R2007a, in Windows Vista and 7.
The problem is clearly related to some โoffensiveโ characters (or character sets / encodings?), But I have no idea. Can anyone understand why this is happening? And how to get around this?
EDIT
This seems to be fixed in R2015a (maybe earlier): it returns correctly
Name: 'C:\Users\Luis\Desktop\tmp\ aaa.txt' archive: 1 system: 0 hidden: 0 directory: 0 [...]
source share