bugGNU Octave - Bugs: bug #34259, Compatibility: save with empty...

 
 

bug #34259: Compatibility: save with empty variable names

Submitter:  Guillaume <gyom>
Submitted:  Fri 09 Sep 2011 05:00:40 PM UTC
   
 
Category:  Octave Function Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 30 Aug 2013 02:54:07 AM UTC, comment #3: 

This was rather easy so I fixed it here (http://hg.savannah.gnu.org/hgweb/octave/rev/cb27dbf9e4ba).  Closing report.

Rik <rik5>
Group administrator
Tue 13 Aug 2013 12:18:52 PM UTC, comment #2: 

Thanks for looking into this.

I find pertinent MATLAB throwing and error in the absence of a variable (rather than a warning) but I actually filled in a bug report here because I didn't want anything to be displayed if an empty variable name is given - adding an ID will fix it for me but maybe MATLAB behaviour could be used here in this special case so as an empty variable name is silently ignored.

Guillaume <gyom>
Sun 28 Jul 2013 03:54:51 PM UTC, comment #1: 

Confirmed; however, note that the variables you wanted to save are indeed saved to the file, the only problem is the warning for each unknown variable or empty argument.

Would you consider this fixed if the warning had an ID that you could selectively disable with something like:


octave:1> warning ("off", "Octave:save-unknown-variable");


Mike Miller <mtmiller>
Group Member
Fri 09 Sep 2011 05:00:40 PM UTC, original submission:  

There is a small difference in behaviour between Octave and MATLAB when using 'save' with empty variable names or non-existing variables:

In MATLAB:

>> clear
>> a = 1;
>> save('file.mat','a','b')
Error using save
Variable 'b' not found.
>> save('file.mat','a','')
>>


In Octave:

octave> clear
octave> a = 1;
octave> save('file.mat','a','b')
warning: save: no such variable `b'
octave> save('file.mat','a','')
warning: save: no such variable `'
octave>


I.e. Octave returns a warning while MATLAB returns an error for unknown variables.
Furthermore MATLAB ignores silently an empty variable name while Octave issues a warning.

I would advocate for a silent execution for the latter as it would allow the following:

opt = '-mat'; % or '' for no option
save('file.mat','a',opt);


Guillaume <gyom>

 

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

Attach Files:
   
   
Comment:
   

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 rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by gyom (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-08-30 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2013-07-28 mtmiller CategoryNone Octave Function
        Severity3 - Normal 2 - Minor
        StatusNone Need Info
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code