changeset 3866:67c500559ac1

[project @ 2001-12-05 18:48:42 by jwe]
author jwe
date Wed, 05 Dec 2001 18:48:43 +0000
parents 4592f72b7317
children 81552337b120
files src/ChangeLog src/load-save.cc
diffstat 2 files changed, 21 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2001-12-05  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* 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  <jwe@bevo.che.wisc.edu>
 
 	* data.cc (DATA_REDUCTION): If no DIM arg, pass -1 to FCN.
--- 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 ();