tbeu / matio

MATLAB MAT File I/O Library
https://matio.sourceforge.io
BSD 2-Clause "Simplified" License
330 stars 97 forks source link

Reading sparse array - invalid number of elements #156

Closed addroz closed 3 years ago

addroz commented 3 years ago

Hi,

I read a MAT file using matio, and casting the data to mat_sparse_t seems to work wrong. The sparse array has 632 non-empty elements, but the value of nir field is 641. Is that a bug or I do sth wrong? I attach the test

mathworks100.zip

tbeu commented 3 years ago

Confirmed, but 641 is the number obtained from the file. If I load your MAT file and save it again in MATLAB R2019a, I get the expected numbers when reading in matio: T156.zip. To me it looks like an issue in the MATLAB version you saved the variables A and U.