help-octave
[Top][All Lists]
Advanced

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

"warning" control syntax difference between Matlab and Octave 3.6.1


From: Stefan
Subject: "warning" control syntax difference between Matlab and Octave 3.6.1
Date: Wed, 2 May 2012 09:53:03 -0700 (PDT)

Hello,

I am trying to run a 3rd party library that was originally written for
Matlab under Octave 3.6.1 under Mac OS X. The library uses the following
(apparently undocumented) syntax to temporarily switch off 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 warnoffId is NOT in w0. 

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

>> 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:

    identifier
    state

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 would much like to use the unmodified library m-files. I read somewhere
that a difference between Matlab and Octave is usually considered a bug in
Octave... Is it in this case?

As a quick fix, I am considering to overload "warning" using "builtin". Any
reasons why this wouldn't work?

Many thanks,
Stefan



--
View this message in context: 
http://octave.1599824.n4.nabble.com/warning-control-syntax-difference-between-Matlab-and-Octave-3-6-1-tp4603803.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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