help-octave
[Top][All Lists]
Advanced

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

Re: Global variables are not restored with load()


From: Ben Abbott
Subject: Re: Global variables are not restored with load()
Date: Sat, 05 Jun 2010 12:35:03 -0400

On Jun 5, 2010, at 10:52 AM, Stefan Neumann wrote:

> Hello,
> 
> this saves the variables to file:
> 
> global a = -1
> b = -2
> save 'a.dat'
> 
> When octave is restarted then
> 
> load 'a.dat'
> 
> will not restore the global variable a, only the non-global b.
> 
> I found no mention of this in the docs. Is there a way to get octave to load 
> the global variables ?
> 
> THX
> stn

I did a quick test of the developers sources and octave-3.2.3. For each, the 
global attribute was preserved. Perhaps an upgrade to a newer version will 
resolve the problem for you?

-----------------------------------
octave:2> clear all
octave:3> global a
octave:4> a = 1;
octave:5> b = 2;
octave:6> save test.mat
octave:7> clear all
octave:8> load test.mat
octave:9> whos
Variables in the current scope:

  Attr Name        Size                     Bytes  Class
  ==== ====        ====                     =====  ===== 
    g  a           1x1                          8  double
       b           1x1                          8  double

Total is 2 elements using 16 bytes
-----------------------------------

Ben




reply via email to

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