From help-octave-request at bevo dot che dot wisc dot edu Wed Dec 5 12:52:26 2001 Subject: saving ranges (was -mat-binary (was : Re: saving structs)) From: Paul Kienzle To: "E. Joshua Rigler" , mark.esplin@sdl.usu.edu Cc: Help-Octave Date: Wed, 5 Dec 2001 13:50:54 -0500 I am returning lag as type "range" rather than type "matrix". Apparently ranges are only supported for ascii in load/save. To convert a range into a matrix you must wrap it with [...]. Returning a range is probably an error on my part. Most operations on ranges first convert them into vectors and operate on the vector, so returning a range saves some memory if it is not used, it is neutral if it is used once, and it cost some time if it is used many times. I will change xcorr to return a matrix instead. Paul Kienzle pkienzle at users dot sf dot net On Wed, Dec 05, 2001 at 11:04:31AM -0700, E. Joshua Rigler wrote: > This is almost completely unrelated, but I'll ask in this thread anyway. > > I almost always use "-mat-binary" to save sessions, just so I can bring > it up in Matlab if need-be. I often use the xcov/xcorr functions, which > can return a "lag" vector. This is an N-column row vector of the > time-lags associated with the correlation function. > > 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. > > -EJR > > ----- > > octave:217> save -mat-binary og.mat * > warning: save: wrong type argument `range' > warning: near line 217, column 1: > > >>> save ("-mat-binary", "og.mat", "*") > > > error: save: error while writing `lag' to MAT file > octave:217> > octave:217> > octave:217> whos la* > > *** local user variables: > > prot type rows cols name > ==== ==== ==== ==== ==== > rwd range 1 481 lag > > octave:218> tmp = lag; > octave:219> clear lag > octave:220> save -mat-binary og.mat * > warning: save: wrong type argument `range' > warning: near line 220, column 1: > > >>> save ("-mat-binary", "og.mat", "*") > > > error: save: error while writing `tmp' to MAT file > octave:220> whos tmp > > *** local user variables: > > prot type rows cols name > ==== ==== ==== ==== ==== > rwd range 1 481 tmp > > octave:221> > octave:221> > octave:221> test > test test_out > octave:221> test_lag = ones (1,481); > octave:222> clear tmp > octave:223> save -mat-binary og.mat * > octave:224> whos test_lag > > *** local user variables: > > prot type rows cols name > ==== ==== ==== ==== ==== > rwd matrix 1 481 test_lag > > > > > > On Wed, 2001-12-05 at 09:06, Mark Esplin wrote: > > You can save and load structs using the Matlab binary format. That is use: > > > > save -mat-binary "test" a > > > > -Mark Esplin > > > > On Wednesday 05 December 2001 07:26 am, Roberto Hernandez wrote: > > > Hey everyone, > > > > > > When trying to save structures I get the following message: > > > > > > ----------------------------------- > > > octave:3> a > > > a = > > > { > > > b = 1 > > > c = 2 > > > } > > > octave:4> save "Test" a > > > warning: save: wrong type argument `struct' > > > > > > warning: near line 4, column 1: > > > >>> save ("Test", "a") > > > > > > ----------------------------------- > > > > _________________________________________________________ > > Do You Yahoo!? > > Get your free at yahoo dot com address at http://mail.yahoo.com > > > > > > > > ------------------------------------------------------------- > > 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 > > ------------------------------------------------------------- > > > > > ------------------------------------------------------------- > 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 > ------------------------------------------------------------- > ------------------------------------------------------------- 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 -------------------------------------------------------------