octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48408] save -append should overwrite a variab


From: Rik
Subject: [Octave-bug-tracker] [bug #48408] save -append should overwrite a variable with the same name
Date: Tue, 5 Jul 2016 16:14:39 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #3, bug #48408 (project octave):

Mike is correct.  Matlab specifically mentions that Matlab overwrites an
existing variable when using -append.

This is annoying, and possibly not worth fixing.  I'm pretty sure Octave just
relies on opening the file in 'append' mode and adding the data at the end of
the file.

The alternative, which Matlab seems to do, is to open the file for reading,
parse through all contents, and copy all the unduplicated variables to a new
file, save in the new or duplicated appended variables, close the file, and
then rename the new temporary file to the old one.

If efficiency isn't a big deal, it might be possible to work at the m-file
level in a separate namespace.  First, clear the namespace of all variables. 
Next, load in the existing file to get all of the variables in the file.  Use
evalin() or somesuch to import the variables that are to be appended. 
Finally, write out all variables in the temporary namespace to the file.  But,
if you have 2GB arrays, then this is going to be cumbersome.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48408>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]