Mathematics Previous page   Next Page

Warnings for Integer Data Types

You can use the intwarning('on') command to make MATLAB return a warning message when it converts a number outside the range of an integer data type to that data type or when the result of an arithmetic operation overflows. For example,

There are four possible warning messages that you can turn on using intwarning. The following example illustrates all four warning messages.

To turn these warnings off (their default state when you start MATLAB), enter

Turning Warnings On or Off Temporarily

When writing M-files that contain integer data types, it is sometimes convenient to temporarily turn integer warnings on and then return the states of the warnings ('on' or 'off') to their previous settings. The following commands illustrate how to do this:

To temporarily turn the warnings off, change the first line of the preceding code to


Previous page  Example -- Digitized Signals Single-Precision Mathematics Next page

© 1994-2005 The MathWorks, Inc.