User`s guide

mbreal
7-15
7mbreal
Purpose Assert variable is real
Syntax mbreal(n)
Description The statement
mbreal(x)
causes the MATLAB Compiler to impute that x is real (not complex). At
run-time, if
mbreal determines that x holds a complex value, mbreal issues an
error message and halts execution of the MEX-file.
mbreal tells the MATLAB interpreter to check whether x holds a real value. If
x does not, mbreal issues an error message and halts execution of the M-file.
The MATLAB interpreter does not use
mbreal to impute x.
Note that
mbreal only tests x at the point in an M-file or MEX-file where an
mbreal call appears. In other words, an mbreal call tests the value of x only
once. If
x becomes complex after the mbreal test, mbreal cannot issue an error
message.
A real value is any scalar, vector, or matrix that contains no imaginary
components.
Example This code in MATLAB causes mbreal to generate an error message because n
contains an imaginary component:
n = 17 + 5i;
mbreal(n);
??? Error using ==> mbreal
Argument to mbreal must be real.
See Also mbrealscalar, mbrealvector, mcc