# HG changeset patch # User jwe # Date 1007578123 0 # Node ID 67c500559ac11d74f8251d63919bf8e9a2f4b60d # Parent 4592f72b7317b25453c234cdc891b08abd16d239 [project @ 2001-12-05 18:48:42 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-12-05 John W. Eaton + + * load-save.cc (save_mat5_binary_element): + Extract dimensions directly from tc. + Handle ranges the same as real matrices. + 2001-11-16 John W. Eaton * data.cc (DATA_REDUCTION): If no DIM arg, pass -1 to FCN. diff --git a/src/load-save.cc b/src/load-save.cc --- a/src/load-save.cc +++ b/src/load-save.cc @@ -4100,7 +4100,7 @@ flags |= mxCHAR_CLASS; else if (tc.is_real_scalar ()) flags |= mxDOUBLE_CLASS; - else if (tc.is_real_matrix ()) + else if (tc.is_real_matrix () || tc.is_range ()) flags |= mxDOUBLE_CLASS; else if (tc.is_complex_scalar ()) flags |= mxDOUBLE_CLASS; @@ -4118,34 +4118,19 @@ os.write ((char *)&junk, 4); // dimensions array subelement - { - if (tc.is_string ()) - { - charMatrix chm = tc.char_matrix_value (); - nr = tc.rows (); - nc = chm.cols (); - } - else if (tc.is_real_scalar () || tc.is_complex_scalar () || tc.is_map ()) - { - nr = nc = 1; - } - else if (tc.is_real_matrix ()) - { - Matrix m = tc.matrix_value (); - nr = m.rows (); - nc = m.columns (); - } - else if (tc.is_complex_matrix ()) - { - ComplexMatrix m = tc.complex_matrix_value (); - nr = m.rows (); - nc = m.columns (); - } - - write_mat5_tag (os, miINT32, 8); - os.write ((char *)&nr, 4); - os.write ((char *)&nc, 4); - } + if (tc.is_map ()) + { + nr = nc = 1; + } + else + { + nr = tc.rows (); + nc = tc.columns (); + } + + write_mat5_tag (os, miINT32, 8); + os.write ((char *)&nr, 4); + os.write ((char *)&nc, 4); // array name subelement { @@ -4191,7 +4176,7 @@ delete [] buf; } - else if (tc.is_real_scalar () || tc.is_real_matrix ()) + else if (tc.is_real_scalar () || tc.is_real_matrix () || tc.is_range ()) { Matrix m = tc.matrix_value ();