Simulink/DymolaBlock: Dymola generated dsin.mat is corrupt and can't be loaded with Matlab. What is wrong with the file?
9 views (last 30 days)
Show older comments
I am using the software Dymola to run models developed with the modeling language Modelica. As an interface to Simulink Dymola provides the DymolaBlock that is basically an S-Function wrapper for models exported from Dymola to Simulink. During the compilation of the Model a dsin.mat is created and supposed to be read by Matlab in order set the initial variable values and some more information. This works fine for simpler models, where the dsin.mat has a size well below ~60MB.
However, for complex models the created dsin.mat can be larger than 100MB and in that case Matlab fails to load this file. Matlab shows the following error after the compilation process has finished in Dymola:
Error using load
Unable to read MAT-file C:\Users\FejPau\Documents\MATLAB\IWT_Simulink\dsin.mat
File may be corrupt.
I am not able to process the created dsin.mat file with Matlab at all. I have contacted the Dymola support in order to ask why Dymola appears to create corrupted files. They answered that the file still can be read by Dymola (which is correct) and proposed to ask here why the file can't be read by Matlab.
Can somebody explain why "load" can't be used with a large dsin.mat? I attached a zip file with both a large (~150MB, corrupted) and a small (~52MB, working perfectly) dsin.mat. Suprisingly these two large binary files can be compressed to less than 1MB (!). Something is really odd with these files.
3 Comments
Answers (0)
See Also
Categories
Find more on Programmatic Model Editing 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!