Error loading matlabprefs.mat
Show older comments
Hallo,
there is an error:
MATLAB:load:notBinaryFile
Unable to read MAT-file /home/myUser/.matlab/R2021a/matlabprefs.mat. Not a binary MAT-file. Try load -ASCII to read as text.
sometimes (this is not reproducible) it pops up after rebooting Matlab:
Warning: Initializing MATLAB Graphics failed.
This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was:
MATLAB:load:unableToReadMatFile
Unable to read MAT-file /home/myUser/.matlab/R2021a/matlabprefs.mat. File might be corrupt.
> In hgrc (line 163)
In matlab.graphics.internal.initialize (line 15)
Some pages (e.g. https://www.mathworks.com/matlabcentral/answers/364986-matlab-error-graphic) recommend deleting matlabprefs.mat. However, if I do, the error pops up again.
I also deleted full ~/.matlab folder. The error was gone for a couple of hours. Now, it reappears.
Does anybody know a persistent solution?
Thanks
6 Comments
Walter Roberson
on 18 Jun 2021
/home/myUser/ ... is that a local drive, or are you accessing a network drive, such as using NFS file system?
Andreas Schwager
on 18 Jun 2021
Andreas Schwager
on 18 Jun 2021
Walter Roberson
on 18 Jun 2021
You look like you are using Linux. When you are getting the error, what shows up for
!file /home/myUser/.matlab/R2021a/matlabprefs.mat
Andreas Schwager
on 18 Jun 2021
Edited: Andreas Schwager
on 18 Jun 2021
Walter Roberson
on 18 Jun 2021
That looks okay at the moment. At a time that MATLAB is telling you the file is corrupt, could you attach the file here for us to look at?
(Note: I am not completely sure where MATLAB stores github keys, or login credentials to reach your Mathworks account, and it is plausible they might be stored in that file, so there is some degree of security risk; I do not know if they are stored in that file or not, or how they might be encoded.)
Accepted Answer
More Answers (1)
LucasBar
on 6 Aug 2024
0 votes
I have this matlabprefs.mat corrupted while I was using batch(). I had 5 sensors collecting data simultaneously, each job batch were reading information from different serial ports. Suddenly, this matlabprefs.mat was corrupted and one sensor stopped to save data. How I could deal with this kind of error. I can not reboot matlab or computer for that. I need to keep my processing running.
Categories
Find more on Startup and Shutdown 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!