MATLAB Compiler    
mbscalar

Assert variable is scalar

Syntax

Description

The statement

causes the MATLAB Compiler to impute that x is a scalar. At run-time, 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:

See Also

mbint, mbintscalar, mbintvector, mbreal, mbrealscalar, mbrealvector, mbvector, mcc


  mbrealvector mbvector