필터 지우기
필터 지우기

When Matlab read file, file name is case insenstive?

조회 수: 8 (최근 30일)
Jason
Jason 2016년 3월 1일
답변: Walter Roberson 2016년 3월 1일
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?

채택된 답변

Walter Roberson
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개)

카테고리

Help CenterFile Exchange에서 Variables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by