From help-octave-request at bevo dot che dot wisc dot edu Thu Dec 6 05:07:57 2001 Subject: Re: Is it possible to save structs? From: Roberto Hernandez To: help-octave at bevo dot che dot wisc dot edu Date: Thu, 06 Dec 2001 07:55:30 -0300 Mark Esplin wrote: > You can save and load structs using the Matlab binary format. That is use: > > save -mat-binary "test" a > > -Mark Esplin > That's a good tip, especially since I'm writing some functions that are meant for end-users who might not be able to apply patches to the source. However, I found a problem with the -mat-binary format when matrix of string elements. The following example illustrates this. If you look at element "c", you'll find a big change after loading the saved struct. The strings say the same thing if you read them by columns, top to bottom and left to right. Is there a way to change this? BTW, if you're teaching any communications classes about coding, this is a great way to illustrate the concept of interleaving ;-). ------------------------------------ octave:9> a a = { b = 1 c = First row second row d = 1 2 3 4 e = 1 2 3 } octave:10> save -mat-binary "test" a octave:11> clear a octave:12> a error: `a' undefined near line 12 column 1 octave:12> load test octave:13> a a = { b = 1 c = Frtrwscn o is o eodrw d = 1 2 3 4 e = 1 2 3 } ------------------------------------ ------------------------------------------------------------- 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 -------------------------------------------------------------