When Matlab read file, file name is case insenstive?
5 次查看(过去 30 天)
显示 更早的评论
If I save a file a abc.csv. It looks like when I read this file, I can use both abc.CSV or AbC.csv? If yes, can you give a reference link?
0 个评论
采纳的回答
Walter Roberson
2016-3-1
Not exactly. MATLAB itself cares about case. However, by default MS Windows NTFS filesystem is not case sensitive (and the FAT* filesystems never even had the option to be anything else); and by default OS-X's HFS filesystem is not case sensitive. So if you are using one of those filesystems, although MATLAB passes the exact name you specify to the operating system, when the operating system passes the name through the filesystem code, the filesystem might match case in-sensitive.
This leads to the old trick on MS Windows: if you want to change the "official" case of a filename, you cannot just rename it from one name to another version of the name in a different case, because the filesystem says "Those are the same". Instead you rename it to some different name and then rename that other name to the final desired name. For example,
rename('abc.CSV', 'temporary.csv'); rename('temporary.csv', 'abc.csv');
Note: it is possible to configure NTFS to be case sensitive, and it is possible to configure OS-X HFS filesystems to be case sensitive.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!