[Top][All Lists]

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

[Octave-bug-tracker] [bug #36393] "warning" control syntax difference be

From: anonymous
Subject: [Octave-bug-tracker] [bug #36393] "warning" control syntax difference between Matlab and Octave 3.6.1
Date: Fri, 04 May 2012 10:10:49 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19


                 Summary: "warning" control syntax difference between Matlab
and Octave 3.6.1
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Fri 04 May 2012 10:10:48 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Stefan
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.1
        Operating System: Mac OS



Matlab's "warning" command has (apparently undocumented) functionality to
update the warning status according to a structure array passed as the first
argument. The following code, found for example in ode15s.m, can be used to
temporarily switch off particular warnings:

w0 = warning;
warnoffId = 'MATLAB:singularMatrix';
warnstat = warning('query',warnoffId);
warnoff = warnstat;
warnoff.state = 'off';

warning(warnoff); %update warning status
% ... do things without warnings thrown
warning(warnstat); %reset warning status
w = warning;

Note that 'MATLAB:singularMatrix' is not listed explicitly in w0 before
setting it to 'off' (i.e., it is handled implicitly under 'all' : 'on').

Behavior in Matlab (R2007b - last version I have for testing): No change of

>> isequal(w,w0) 
ans = 1 

Behavior in Octave 3.6.1: "warning" is overwritten completely by warnstat: 

octave:2> w0 
w0 = 

  1x14 struct array containing the fields: 


octave:3> w 
w = 

  scalar structure containing the fields: 

    identifier: 1x21 sq_string 
    state: 1x2 sq_string 

This breaks the warning system of Octave, such that virtually every subsequent
command spams the console with warning messages. 

I attach a function overloading "warning" that outlines a fix for this issue,
such that MATLAB code using this functionality runs correctly in Octave.

Note that even with the overloaded "warning" command, the status after the
above example is different (but equivalent):

octave:2> isequal(w,w0) 
ans = 0 

This is due to the fact that even

octave:2> warning('on',ID) 

behaves differently in Matlab and Octave. Matlab will just remove ID from the
warning structure array, so that ID is handled implicitly under 'all' : 'on',
while Octave appends ID to the warning structure, with status 'on', regardless
of the state of 'all'.


File Attachments:

Date: Fri 04 May 2012 10:10:48 AM UTC  Name: warning.m  Size: 271B   By: None



Reply to this item at:


  Message sent via/by Savannah

reply via email to

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