| MATLAB Compiler | ![]() |
Assert variable is real scalar.
Syntax
mbrealscalar(n)
Description
mbrealscalar(x)
causes the MATLAB Compiler to impute that x is a real scalar. At runtime, if mbrealscalar determines that x holds a value other than a real scalar, mbrealscalar issues an error message and halts execution of the MEX-file.
mbrealscalar tells the MATLAB interpreter to check whether x holds a real scalar value. If x does not, mbrealscalar issues an error message and halts execution of the M-file. The MATLAB interpreter does not use mbrealscalar to impute x.
Note that mbrealscalar only tests x at the point in an M-file or MEX-file where an mbrealscalar call appears. In other words, an mbrealscalar call tests the value of x only once. If x becomes a vector after the mbrealscalar test, mbrealscalar cannot issue an error message.
mbrealscalar defines a real scalar as any value that meets the criteria of both mbreal and mbscalar.
Example
This code in MATLAB causes mbrealscalar to generate an error message because, although n contains only real numbers, n is not a scalar.
n = [17.2 15.3]; mbrealscalar(n) ??? Error using ==> mbscalar Argument of mbscalar must be scalar.
See Also
mbreal, mbscalar, mbrealvector, mcc
| mbreal | mbrealvector | ![]() |