warning
The default warning state is 'on'. Warnings not set to the default are
State Warning Identifier
off Control:parameterNotSymmetric
MATLAB indicates that Control:parameterNotSymmetric is 'off'.
4 Restore the original state:
warning(orig_state)
warning('query','Control:parameterNotSymmetric')
The state of warning 'Control:parameterNotSymmetric' is 'on'.
Disable and Restore Multiple Warnings
This example shows you how to save and restore multiple warning states.
1 Disable three warnings, and query all the warnings:
w(1) = warning('off','MATLAB:rmpath:DirNotFound');
w(2) = warning('off','MATLAB:singularMatrix');
w(3) = warning('off','Control:parameterNotSymmetric');
warning
The default warning state is 'on'. Warnings not set to the default are
State Warning Identifier
off Control:parameterNotSymmetric
off MATLAB:rmpath:DirNotFound
off MATLAB:singularMatrix
2 Restore the three warnings to their the original state, and query all warnings:
warning(w)
warning
All warnings have the state 'on'.
You do not need to store information about the previous warning states in an array,
but doing so allows you to restore warnings with one command.
26 Error Handling