bugGNU Octave - Bugs: bug #35252, incorrect loading of file (file...

 
 

bug #35252: incorrect loading of file (file saved in same octave version)

Submitter:  None
Submitted:  Fri 06 Jan 2012 05:24:25 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Liesbeth Janssen Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.2.3
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 06 Jan 2012 06:58:13 PM UTC, comment #2: 

Happily this bug has already been fixed, but you will need to upgrade.  The 3.2.X series is deprecated and no longer maintained.  Please try 3.4.3 or if you want to wait ~2 weeks the 3.6.0 release will be out.

Rik <rik5>
Group administrator
Fri 06 Jan 2012 05:30:11 PM UTC, comment #1: 

Only the variables that are declared global are read incorrectly.

Anonymous
Fri 06 Jan 2012 05:24:25 PM UTC, original submission:  

When saving a (binary) file in octave and loading it in the same session, all variables are loaded correctly. Example:

octave:1> octave_path; constants;
octave:2> who
Variables in the current scope:

Ang        c0au       mAr        mCl        mLi6       mO18
Debye      cm1        mB         mCl37      mMg        mP
Debye_g98  coulomb    mB10       mD         mN         mS
GHz        eV         mBe        mF         mN15       mSi
MHz        g_e        mBr        mH         mNa        mXe
NA         gauss      mBr79      mHe        mNe        second
Vcm1       joule      mBr81      mHe3       mNe21      tesla
amu        kboltz     mC         mI         mNe22
ans        kcal       mC13       mK         mO
c0         mAl        mCa        mLi        mO17

octave:3> Ang
Ang =  1.8897
octave:4>
octave:4> save('x.mat','-binary')
octave:5> clear all
octave:6> who
octave:7> load('x.mat')
octave:8> who
Variables in the current scope:

Ang        c0au       mAr        mCl        mLi6       mO18
Debye      cm1        mB         mCl37      mMg        mP
Debye_g98  coulomb    mB10       mD         mN         mS
GHz        eV         mBe        mF         mN15       mSi
MHz        g_e        mBr        mH         mNa        mXe
NA         gauss      mBr79      mHe        mNe        second
Vcm1       joule      mBr81      mHe3       mNe21      tesla
amu        kboltz     mC         mI         mNe22
ans        kcal       mC13       mK         mO
c0         mAl        mCa        mLi        mO17

octave:9> exit

(all of these variables are floating point numbers; see attached file constants.m)

Now, when starting a new octave session and reloading the file x.mat, some variables are missing (in this example e.g. Ang, amu, c0, ...):

octave:1> who
Variables in the current scope:

ans

octave:2> load('x.mat')
octave:3> who
Variables in the current scope:

Debye      c0au       mB         mCa        mMg        mO18
Debye_g98  coulomb    mB10       mCl37      mN15       mP
GHz        g_e        mBe        mHe3       mNa        mSi
MHz        gauss      mBr        mI         mNe        mXe
NA         joule      mBr79      mK         mNe21      second
Vcm1       kboltz     mBr81      mLi        mNe22      tesla
ans        mAl        mC13       mLi6       mO17


However, the missing variable(s) can be loaded correctly if the corresponding variable name is first initialized. Example:

octave:4> Ang
error: `Ang' undefined near line 4 column 1
octave:4> Ang=1
Ang =  1
octave:5> load('x.mat')
octave:6> Ang
Ang =  1.8897
octave:7> who
Variables in the current scope:

Ang        ans        mAl        mC13       mLi6       mO17
Debye      c0au       mB         mCa        mMg        mO18
Debye_g98  coulomb    mB10       mCl37      mN15       mP
GHz        g_e        mBe        mHe3       mNa        mSi
MHz        gauss      mBr        mI         mNe        mXe
NA         joule      mBr79      mK         mNe21      second
Vcm1       kboltz     mBr81      mLi        mNe22      tesla


(note that only Ang is added, other variables such as amu and c0 are still missing)

The problem seems to be independent of file format; omitting the '-binary' flag, or using e.g. '-v7', makes no difference.

The saving and loading is done in the same version of octave, so this is not a compatibility issue between different versions.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #24749:  constants.m added by None (3KiB - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-01-06 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2012-01-06 None Attached File- Added constants.m, #24749

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code