MATLAB Compiler | ![]() ![]() |
Assert variable is a MATLAB character string.
Syntax
mbchar(x)
Description
mbchar(x)
causes the MATLAB Compiler to impute that x
is a char
matrix. At runtime, if mbchar
determines that x
does not hold a char
matrix, mbchar
issues an error message and halts execution of the MEX-file.
mbchar
tells the MATLAB interpreter to check whether x
holds a char
matrix. If x
does not, mbchar
issues an error message and halts execution of the M-file. The MATLAB interpreter does not use mbchar
to impute x
.
Note that mbchar
only tests x
at the point in an M-file or MEX-file where an mbchar
call appears. In other words, an mbchar
call tests the value of x
only once. If x
becomes something other than a char
matrix after the mbchar
test, mbchar
cannot issue an error message.
A char
matrix is any scalar, vector, or matrix that contains only the char
data type.
Example
This code in MATLAB causes mbchar
to generate an error message because n
does not contain a char
matrix.
n = 17;
mbchar
(n);
??? Error using ==> mbchar
Argument to mbchar must be of class 'char'.
See Also
mbcharvector
, mbcharscalar
, mbreal
, mbscalar
, mbvector
, mbintscalar
, mbintvector
, mcc
![]() | Functions | mbcharscalar | ![]() |