how to make matlab support capital letters .MAT file format

3 views (last 30 days)
I'm on mac os lion, I have .MAT files needed to process with matlab, but cannot load and i have to change the extension all the time to .mat file extension. is there a way to set matlab to also handle the capital letters .MAT file extension. PS, I have more than 200 files every time for changing extension.
  2 Comments
dpb
dpb on 8 Oct 2013
Why not quit making inconsistently-named files instead?
Show your code -- altho I don't have a system to test on, I'd presume if you match case in the filename given load that should pass through ok...
Or, if you can't implement solution 1) and you're going to be stuck with this going forward and can't just do a global rename on the OS shell side to the lowercase version of the extension, write a function that does the rename internally before it calls load. But, this would be last choice of preference.
Cedric
Cedric on 8 Oct 2013
If you inherited these files and have no control over how they are/were named, you can build a small script which renames all files with lower case extension.

Sign in to comment.

Answers (1)

Jan
Jan on 8 Oct 2013
Edited: Jan on 8 Oct 2013
I cannot test it, but this should work:
Data = load('FileName.MAT', '-MAT');
If this can import files with any extension assuming they have MAT format, why shouldn't this work for '.MAT' also?
Anyway, I'd prefer a clean naming scheme instead. But I had some '.MAT' files also on an old ISO9660 CD, such that renaming would require a copy to the hard disk at first.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!