Mercurial > hg > octave-lyh
diff libinterp/interp-core/ls-mat5.cc @ 15347:9ed4fc294f3f
when writing sparse matrices to MAT files, use nzmax of at least 1 (bug #36603)
* ls-mat5.cc (save_mat5_binary_element): If nnz is 0, write 1 for
nzmax in array flags element.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 11 Sep 2012 01:47:48 -0400 |
parents | 336f42406671 |
children | 049e8bbff782 |
line wrap: on
line diff
--- a/libinterp/interp-core/ls-mat5.cc +++ b/libinterp/interp-core/ls-mat5.cc @@ -2429,6 +2429,10 @@ } os.write (reinterpret_cast<char *> (&flags), 4); + // Matlab seems to have trouble reading files that have nzmax == 0 at + // this point in the file. + if (nnz_32 == 0) + nnz_32 = 1; os.write (reinterpret_cast<char *> (&nnz_32), 4); write_mat5_tag (os, miINT32, dim_len);