bugGNU Octave - Bugs: bug #54736, load() should issue an error if...


bug #54736: load() should issue an error if specified variable does not exist in file

Submitted by:  Guillaume <gyom>
Submitted on:  Wed 26 Sep 2018 04:41:25 PM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  3 - Low Item Group:  Missed Error or Warning
Status:  Confirmed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 12 Oct 2018 04:37:59 AM UTC, comment #4:

There is more oddness to this bug report. If the saved file format is Octave binary then no error is ever printed regardless of whether one or more of the requested variables does not exist.

Rik <rik5>
Project Administrator
Thu 27 Sep 2018 04:23:26 PM UTC, comment #3:

Yes. I assumed that was the case where Octave iterated over the list of variables ('A', 'B', ...) and tried each one individually. I tried your test case and it doesn't so that should be fixed.

Re-titling and re-opening bug report.

Rik <rik5>
Project Administrator
Thu 27 Sep 2018 03:52:50 PM UTC, comment #2:

In that case, should we also throw an error for

if A.mat doesn't contain a variable named B?

John W. Eaton <jwe>
Project Administrator
Thu 27 Sep 2018 03:46:11 PM UTC, comment #1:

I understand that Octave is different in this regard, but I want to keep the stricter checking.

Philosophically, I prefer that Octave signal to the programmer at the earliest possible opportunity when something has gone wrong. This makes debugging easier because the problem and the resulting error are located close together.

Matlab's approach is often to return a silent null ([]) when things go wrong. But this allows the script to continue and it may be quite a while before the error is detected, or maybe never. Many scripts are run in batch mode and so warning messages printed are never seen, whereas a hard error will be detected.

Rik <rik5>
Project Administrator
Wed 26 Sep 2018 04:41:25 PM UTC, original submission:

When trying to load a named variable of a mat-file, if it is not present, Octave returns an error while Matlab displays a warning and returns an empty structure.



Guillaume <gyom>


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-02 rik5 Priority5 - Normal => 3 - Low
    2018-09-27 rik5 Item GroupMatlab Compatibility => Missed Error or Warning
        StatusWont Fix => Confirmed
        Open/ClosedClosed => Open
        SummaryBehavior of load() when a specified name keyword is missing => load() should issue an error if specified variable does not exist in file
    2018-09-27 rik5 StatusNone => Wont Fix
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.4