My problem is to open some MAT-files generated by Dymola. Some times for small models MATLAB has no problem to open the created MAT-file. Then I can see the structure in the workspace. But I have also a huge simulation model with 31.536.000 data points. For this model MATLAB is not able to open it. I always get the hint
Error using load
Unable to read MAT-file C:\Users\Patrick\Desktop\DymolaWork\GridHH_SLP.mat
File may be corrupt.
My MATLAB version is R2014a 64bit and my Dymola version is 2014 FD001 64bit.
I also tried to fix the problem with a tool provided on the MathWorks homepage to solve corrupted variable names (loadfixnames
/savebadnames
). But that does not work quite right because this tool cannot restore the matrix data_2
. Can anybody give me an advise to solve this problem?
It should not be a problem with the Matlab4 format. The number of rows and columns of a matrix are stored as 2 32-bit unsigned integers, which should make a double matrix of size 8*(2^32-1) *(2^32-1) possible. It is just an implementation issue for reading the format.
Given the number of data points, if the model has more than roughly 136 variables, the total size of the data_2 matrix is greater than 4GB (you can probably tell from the file size of GridHH_SLP.mat if this is true). If this is the case, maybe Matlab was not programmed to handle matrices of this size. I tried a 39GB data_2 matrix in Octave and it just says: error: out of memory or dimension too large for Octave's index type
. I could open the same file in OpenModelica (but it is inefficient for plotting such large files because they are not saved in transposed format by default).
If Dymola is capable of outputting a fewer number of variables, the file could work fine in Matlab. You could also try the program alist
that comes with Dymola to output select variables in a mat-file into csv format (if alist can handle large files).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With