MATLAB Compiler    
mbreal

Assert variable is real

Syntax

Description

The statement

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:

See Also

mbrealscalar, mbrealvector, mcc


  mbintvector mbrealscalar