help-octave
[Top][All Lists]
Advanced

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

Re: "warning" control syntax difference between Matlab and Octave 3.6.1


From: Stefan
Subject: Re: "warning" control syntax difference between Matlab and Octave 3.6.1
Date: Wed, 2 May 2012 11:00:50 -0700 (PDT)

OK, this is a workaround for my problem:

%-----------------------------------------
function varargout = warning(varargin)

if nargin == 1 && isstruct(varargin{1})
    for j = 1:length(varargin{1})
        w = varargin{1}(j);
        builtin('warning',w.state,w.identifier);
    end
else
    [varargout{1:nargout}] = builtin('warning',varargin{:});
end
%-----------------------------------------

Now the Matlab library works without modifications in Octave, and I think I
haven't compromised the functionality of "warning" too much. Obviously,
"help warning" wouldn't work right now, unless I paste the doc string into
the overloading file.

Note that even

>> warning('on',ID)

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

While the fix above apparently works, it seems these differences in the
handling of the warning structure array could be easily removed on Octave's
side.

Many thanks for your time,
Stefan


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


reply via email to

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