User`s guide
mbint
7-12
7mbint
Purpose Assert variable is integer.
Syntax mbint(n)
Description The statement
mbint(x)
causes the MATLAB Compiler to impute that x is an integer. At runtime, if
mbint determinesthatx holds a nonintegervalue,thegenerated codeissuesan
error message and halts execution of the MEX-file.
mbint tellsthe MATLAB interpretertocheckwhether x holds an integer value.
If
x does not, mbint issues an error message and halts execution of the M-file.
The MATLAB interpreter does not use
mbint to impute a data type to x.
Note that
mbint only tests x at the point in an M-file or MEX-file where an
mbint call appears. In other words, an mbint call tests the value of x only once.
If
x becomes a noninteger after the mbint test, mbint cannot issue an error
message.
mbint defines an integer as any scalar, vector, or matrix that contains only
integerorstringvalues.Forexample,
mbint considers n to be an integer
because all elements in
n are integers.
n = [5 7 9];
If even one element of n contains a fractional component, for example,
n = [5 7 9.2];
then mbint assumes that n is not an integer.
mbint considers all strings to be integers.
If
n is a complexnumber, thenmbint considers n to be an integer if both its real
and imaginary part s are integers. For example,
mbint considers t he value of n
an integer.
n = 4 + 7i