MATLAB: Error: MAT file cannot be loaded because it contains duplicate variables

.mat fileinputloadoutputsave

I saved 10 very large MAT files that contain simulation results (each is the result of running the same script, with different input parameters, on 10 separate nodes of a supercomputer). For some reason, one of these files (the second one that was saved) has a problem, and MATLAB gives the following error message: "MAT file cannot be loaded because it contains duplicate variables." However, all 10 of the MAT files that were created contain the same variables and there are no duplicate variables in any of the other MAT files.
I have two questions: (1) Is there any workaround to access the data in this MAT file? (2) Does anyone know how this might have happened so I can avoid it in the future?

Best Answer

It turns out the problem was that MATLAB closed before the MAT file was finished saving, so it was just corrupted. The solution was (unfortunately) to just recompute and save it again.