Borrar filtros
Borrar filtros

When Matlab read file, file name is case insenstive?

8 visualizaciones (últimos 30 días)
Jason
Jason el 1 de Mzo. de 2016
Respondida: Walter Roberson el 1 de Mzo. de 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?

Respuesta aceptada

Walter Roberson
Walter Roberson el 1 de Mzo. de 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.

Más respuestas (0)

Categorías

Más información sobre Variables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by