Opening .mat files no longer works in R2013b

2 views (last 30 days)
colmanp
colmanp on 9 Oct 2014
Commented: colmanp on 10 Oct 2014
Hello, I recently updated my MATLAB to R2013b. A large code that worked fine in the previous version (I believe this was MATLAB 7.2) now no longer runs. The code reads data files from .mat files which are held in another folder. In matlab 2013b the error message that appears is: Unable to read MAT-file not a binary MAT-file. Try LOAD -ASCII to read as text. When I put the mat file in the folder where the code is run then it reads fine. How do I get the mat file to also be readable from the other folder? Thanks!

Answers (2)

Adam
Adam on 9 Oct 2014
If it is just a folder issue then you can probably achieve it by adding the folder containing it to your path which it may already have been in your previous Matlab since upgrades do not retain path.
Otherwise you should just be able to refer to it via its full path. Unless I am totally misremembering .mat files do not need to be on your path, but if you are trying to just refer to them by filename without the full path then they do.
  5 Comments
Guillaume
Guillaume on 10 Oct 2014
Looks like a bug, the same thing happens to me in 2013b.
Also looks like it's fixed in 2014b. As I'm not aware of mathworks fixing bugs in older versions, you're probably stuck with it.
You can always cd into the directory instead of adding it to the path.
colmanp
colmanp on 10 Oct 2014
Thanks Guillaume - I will try get my hands on R2014b..

Sign in to comment.


Matt J
Matt J on 9 Oct 2014
Sounds like a path problem. Since you recently installed a new MATLAB version, it seems likely that you simply didn't modify the MATLAB path to include all your usual data folders.
  2 Comments
colmanp
colmanp on 9 Oct 2014
Thanks for the idea.. I am still having trouble - I wrote some more details in my comment to Adam above..
Matt J
Matt J on 10 Oct 2014
Do not create (or work in) subfolders on your Desktop. It does not behave like other folders and is meant just for holding shortcuts.
Also, notice from the error message that load is looking in the wrong subfolder for your file (the path name has two Desktops, Users, etc... in it). I don't know how that path got created or why a version of test1.mat resides there, but you must use full path names when using addpath, i.e,
'C:/Users/etc...'
Anyway, the problem must be coming from specific thing about your environment (and Guillaume's). I've been using R2013b for over a year now, and have been opening .mat files without any unusual difficulties.

Sign in to comment.

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!