| MATLAB Compiler | ![]() |
Syntax
mbscalar(n)
Description
mbscalar(x)
causes the MATLAB Compiler to impute that x is a scalar. At runtime, if mbscalar determines that x holds a nonscalar value, mbscalar issues an error message and halts execution of the MEX-file.
mbscalar tells the MATLAB interpreter to check whether x holds a scalar value. If x does not, mbscalar issues an error message and halts execution of the M-file. The MATLAB interpreter does not use mbscalar to impute x.
Note that mbscalar only tests x at the point in an M-file or MEX-file where an mbscalar call appears. In other words, an mbscalar call tests the value of x only once. If x becomes nonscalar after the mbscalar test, mbscalar cannot issue an error message.
mbscalar defines a scalar as a matrix whose dimensions are 1-by-1.
Example
This code in MATLAB causes mbscalar to generate an error message because n does not hold a scalar.
n = [1 2 3]; mbscalar(n); ??? Error using ==> mbscalar Argument of mbscalar must be scalar.
See Also
mbint, mbintscalar, mbintvector, mbreal, mbrealscalar, mbrealvector, mbvector, mcc
| mbrealvector | mbvector | ![]() |