Source: https:? //Ww2.mathworks.cn/help/matlab/ref/ischar.html searchHighlight = ischar & s_tid = doc_srchtitle
tf = ischar(A)
Examples
If the Acharacter array, then the logical value returned ( ); logical value otherwise ( ).tf = ischar(A)1true0false
A
1
true
0
false
Collapse
Create a number of different array, and then determine whether they are an array of characters.
A character test vectors.
chr = 'Mary Jones'
tf = ischar (CHR)
tf = logical 1
Test an array of numbers.
X = rand(1,3)
X = 1×3 0.8147 0.9058 0.1270
tf = ischar(X)
tf = logical 0
Test string array. R2017a from the start, you can create strings using double quotes.
str = ["Smith","Chung","Morales"; ... "Sanchez","Peterson","Adams"]
str = 2x3 string array "Smith" "Chung" "Morales" "Sanchez" "Peterson" "Adams"
tf = ischar(str)
strIs a string array instead of a character array, therefore ischarreturn 0.
str
ischar
Input array, is designated as a scalar, vector, matrix or multidimensional array. AIt can be any data type.
This function fully supports GPU array. For more information, see the Run MATLAB Functions ON A GPU (Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, see the Run Functions with MATLAB Distributed Arrays (Parallel Computing Toolbox).
cellstr | char | is* | isa | iscellstr | isletter | isnumeric | isspace | isstring | isstrprop | string
cellstr
char
is*
isa
iscellstr
isletter
isnumeric
isspace
isstring
isstrprop
string