Filter löschen
Filter löschen

When Matlab read file, file name is case insenstive?

8 Ansichten (letzte 30 Tage)
Jason
Jason am 1 Mär. 2016
Beantwortet: Walter Roberson am 1 Mär. 2016
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?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 1 Mär. 2016
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.

Weitere Antworten (0)

Kategorien

Mehr zu Variables finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by