User`s guide
mbcharvector
7-11
7mbcharvector
Purpose Assert variable is a character vector, i.e., a MATLAB string.
Syntax mbcharvector(x)
Description The statement
mbcharvector(x)
causes the MATLAB Compiler to impute that x is a char vector. At runtime, if
mbcharvector determines that x holds a value other than a char vector,
mbcharvector issues an error message and halts execution of the MEX-file.
mbcharvector tell s t he MAT LAB interpreter to check whether x holds a char
vector value. If x does not, mbcharvector issues an error message and halts
execution of the M-file. The MATLAB interpreter does not use
mbcharvector
to impute x.
Note that
mbcharvector only tests x atthepointinan M-fileorMEX-filewhere
an
mbcharvector call appears. In other words, an mbcharvector call tests the
value of
x only once. If x becomes something other than a char vector after the
mbcharvector test, mbcharvector cannot issue an error message.
mbcharvector definesachar vector as any value that meets the criteria of both
mbchar and mbvector.Notethatmbcharvector considers char scalars as char
vectors as well.
Example This code in MATLAB causes mbcharvector to generate a n error message
because, although
n is a vector, n contains one value that is not a char.
n = [1:5];
mbcharvector(n)
??? Error using ==> mbchar
Argument to mbchar must be of class 'char'.
See Also mbchar, mbcharscalar, mbreal, mbscalar, mbvector, mbintscalar,
mbintvector, mcc