Why do I get this error when loading a Matlab created file?
2 views (last 30 days)
This is the full error message that I am receiving. I created these files in matlab and when I try to load them I get the following error message:
Error using load
Unable to read MAT-file /Users/........./Vs.mat. Not a binary MAT-file. Try load -ASCII to read as
I tried using load('Vs.mat','-ascii') but this creates a blank vector and I am trying to load a vector.
Krishna on 26 Aug 2022
I understand that you are facing issue while running matlab files. One reason you may be receiving the error "Unable to read MAT-file" is because multiple instances of MATLAB running on the same machine are not inherently synchronized when accessing shared resources. If two instances of MATLAB are accessing the same data, there is a chance the data may become corrupted.
A possible workaround for this issue would be to create a "lock" file for each instance of MATLAB, and before performing any operations on the data, check to ensure the other instance's "lock" file doesn't exist. This would indicate if it is safe to read or write to that MAT-file.Attached is a pair of files, "writer.m" and "reader.m". These files demonstrate one possible workflow for creating these "lock" files.
I hope this solves your issue.