[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"-mat-binary" (was : Re: Is it possible to save structs?)
From: |
John W. Eaton |
Subject: |
"-mat-binary" (was : Re: Is it possible to save structs?) |
Date: |
Wed, 5 Dec 2001 12:46:49 -0600 |
On 5-Dec-2001, E. Joshua Rigler <address@hidden> wrote:
| If this vector is in memory (it doesn't matter what it is called), I get
| an error when trying to save all my variables to "-mat-binary". Just to
| waste band-width, I've attached a summary of commands and output that
| illustrate this problem. Is the "lag" vector returned from the
| xcov/xcorr functions a strange data-type? This is just weird, but not
| any kind of show-stopper. I use 2.1.34 under RH Linux 7.1.
Please try the following patch.
jwe
2001-12-05 John W. Eaton <address@hidden>
* load-save.cc (save_mat5_binary_element):
Extract dimensions directly from tc.
Handle ranges the same as real matrices.
Index: load-save.cc
===================================================================
RCS file: /usr/local/cvsroot/octave/src/load-save.cc,v
retrieving revision 1.136
diff -u -r1.136 load-save.cc
--- load-save.cc 27 Jun 2001 02:29:03 -0000 1.136
+++ load-save.cc 5 Dec 2001 18:45:28 -0000
@@ -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 ();
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------