MATLAB: Am I unable to save two different variables as MAT-files when the names differ in the case of the letters

casefileinsensitivematMATLABsensitivevariable

I have two variables in MATLAB whose names differ in the case of the letters, e.g., myVariable and MyVariable. MATLAB treats these two as different variables, but when I save them as MAT-files in Windows, I can save only one. In other words, the following code results in only one file:
myVariable = 1;
MyVariable = 2;
save myVariable myVariable
save MyVariable MyVariable
clear
load myVariable
whos
The output is:
Name Size Bytes Class
MyVariable 1x1 8 double array
Grand total is 1 element using 8 bytes
The wrong variable is loaded into the MATLAB workspace.

Best Answer

This is due to case-insensitive file names in Windows. Although Windows is case preserving in creating file names, it is case insensitive in matching file names. It is not possible to save two files in the same folder that differ only in the case of one or more letters.