Fri 04 May 2012 10:10:48 AM UTC, original submission:
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:
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 "warning":
Behavior in Octave 3.6.1: "warning" is overwritten completely by warnstat:
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):
This is due to the fact that even
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'.
|