save/load anonymous function loses empty string in returned cell-array

John W. Eaton jwe at bevo.che.wisc.edu
Fri Apr 4 15:03:17 CDT 2008


On  4-Apr-2008, Olaf Till wrote:

| On Thu, Apr 03, 2008 at 02:14:55PM -0400, John W. Eaton wrote:
| Content-Description: message body text
| > On  3-Apr-2008, Olaf Till wrote:
| > 
| > | Octave version: 3.0 (on Debian stable, from a package in unstable)
| > | 
| > | If an anonymous function which returns a cell-array containing an
| > | empty string is saved and reloaded, the entry with the empty string in
| > | the cell-array to be returned is lost:
| > | 
| > | octave3.0:39> a = @ () {""}
| > | a =
| > | 
| > | @() {}
| > | 
| > | octave3.0:40> save -binary test.dat a
| > | octave3.0:41> load test.dat
| > | octave3.0:42> a 
| > | a =
| > | 
| > | @() {}(0x0)
| > 
| > Please try the following change.
| > 
| > Thanks,
| > 
| > jwe
| 
| With the patch, it is fixed, but:
| 
| I don't know, but with the patch the quotes around the string seem to
| be stored literally, i.e. single quotes or double quotes, depending on
| which were typed in. Will that not break saving in -mat format, if the
| string was given with double quotes? I can not test, since saving
| anonymous functions in -mat format does not work now anyway.

I don't see a good way to solve that problem.  If you want to store
things in .mat files that can be loaded in Matlab, use
Matlab-compatible syntax.  Octave should be able to load the file
either way.

I also applied the following patch to handle escape sequences in
double-quoted character strings.

jwe


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080404/b7cdc18d/attachment.ksh 


More information about the Bug-octave mailing list