ischar - Determine if input is character array - MATLAB (original) (raw)
Main Content
Determine if input is character array
Syntax
Description
tf = ischar([A](#bvh32el-A))
returns logical 1
(true
) if A
is a character array and logical 0
(false
) otherwise.
Examples
Create different arrays, and then determine if they are character arrays.
Test a character vector.
Test a numeric array.
X = 1×3
0.8147 0.9058 0.1270
Test a string array.
str = ["Smith","Chung","Morales"; ... "Sanchez","Peterson","Adams"]
str = 2×3 string "Smith" "Chung" "Morales" "Sanchez" "Peterson" "Adams"
str
is a string array, not a character array, so ischar
returns 0
.
Input Arguments
Input array, specified as a scalar, vector, matrix, or multidimensional array. A
can be any data type.
Extended Capabilities
The ischar
function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006a