MATLAB Compiler    
mbcharvector

Assert variable is a character vector, i.e., a MATLAB string

Syntax

Description

The statement

causes the MATLAB Compiler to impute that x is a char vector. At run-time, 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 tells the MATLAB 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 at the point in an M-file or MEX-file where 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 defines a char vector as any value that meets the criteria of both mbchar and mbvector. Note that mbcharvector considers char scalars as char vectors as well.

Example

This code in MATLAB causes mbcharvector to generate an error message because, although n is a vector, n contains one value that is not a char:

See Also

mbchar, mbcharscalar, mbreal, mbscalar, mbvector, mbintscalar, mbintvector, mcc


  mbcharscalar mbint