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

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

[Octave-bug-tracker] [bug #48408] Changing a variable and saving file wi


From: Rik
Subject: [Octave-bug-tracker] [bug #48408] Changing a variable and saving file with -append in Octave makes it impossible to load a particular variable in MATLAB
Date: Tue, 5 Jul 2016 15:48:00 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Update of bug #48408 (project octave):

              Item Group:        Incorrect Result => Matlab Compatibility   
                  Status:               Confirmed => None                   
        Operating System:                     Any => Microsoft Windows      
                 Summary: save -append should overwrite a variable with the
same name => Changing a variable and saving file with -append in Octave makes
it impossible to load a particular variable in MATLAB

    _______________________________________________________

Follow-up Comment #2:

I've changed the Item Group to Matlab Compatibility, and marked it as minor
since there is the obvious workaround of loading the whole file.

The sequence of commands works as long as one stays in Octave.  This leads me
to believe that it is Matlab which has the issue.  My guess is that even for
'-append', they may be checking whether the variable exists and replacing the
variable, rather than appending it.

In Octave, I checked the size of the generated file after every save command.


x = 1
save -v7 tst.mat x
ls -l tst.mat
  -rw-rw-r-- 1 rik rik 174 Jul  5 08:38 tst.mat
b = zeros (2,2);
save -v7 -append tst.mat b
ls -l tst.mat
  -rw-rw-r-- 1 rik rik 220 Jul  5 08:38 tst.mat
b(1,1) = 1
save -v7 -append tst.mat b
ls -l tst.mat
  -rw-rw-r-- 1 rik rik 271 Jul  5 08:39 tst.mat


You might try the entire sequence under Matlab and see if the file always
grows, or whether they are replacing variables.

The other thing to try is changing the b variable to something which is of a
different size or type in Octave.  Repeat the first steps you did to create
datafile.mat in Matlab.  But in Octave, try


b = repmat (i, [3,2]);
save -v7 -append datafile.mat b


Then try loading the file in Matlab.  If Matlab is really just using the first
instance of a 'b' variable that it finds in the file then this will still be
zeros(2,2).


    _______________________________________________________

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]