23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Numeric Types<br />

The state of warning '<strong>MATLAB</strong>:intMathOverflow' is 'off'.<br />

To display the state of one or more selected warnings, index into the structure<br />

returned by intwarning. This example shows the current state of the<br />

intConvertOverflow warning:<br />

iwState = intwarning('query');<br />

iwState(3)<br />

ans =<br />

identifier: '<strong>MATLAB</strong>:intConvertOverflow'<br />

state: 'off'<br />

Turning the Warning On. To enable all four integer warnings, use<br />

intwarning with the string 'on':<br />

intwarning('on');<br />

intwarning('query')<br />

The state of warning '<strong>MATLAB</strong>:intConvertNaN' is 'on'.<br />

The state of warning '<strong>MATLAB</strong>:intConvertNonIntVal' is 'on'.<br />

The state of warning '<strong>MATLAB</strong>:intConvertOverflow' is 'on'.<br />

The state of warning '<strong>MATLAB</strong>:intMathOverflow' is 'on'.<br />

To enable one or more selected integer warnings, first make sure that all<br />

integer warnings are disabled:<br />

intwarning('off');<br />

Note that, in this state, the following conversion to a 16-bit integer overflows,<br />

but does not issue a warning:<br />

x = int16(50000)<br />

x =<br />

32767<br />

Find which of the four warnings covers integer conversion. In this case, it<br />

is the third in the structure array:<br />

iwState = intwarning('query');<br />

iwState(3).identifier<br />

ans =<br />

<strong>MATLAB</strong>:intConvertOverflow<br />

2-11

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!