Skip to Main Content Skip to Search
Product Documentation

ischar - Determine whether item is character array

Syntax

tf = ischar(A)

Description

tf = ischar(A) returns logical 1 (true) if A is a character array and logical 0 (false) otherwise.

Examples

Given the following cell array,

C{1,1} = magic(3);           % double array
C{1,2} = 'John Doe';         % char array
C{1,3} = 2 + 4i              % complex double

C = 

    [3x3 double]    'John Doe'    [2.0000+ 4.0000i]

ischar shows that only C{1,2} is a character array.

for k = 1:3
x(k) = ischar(C{1,k});
end

x

x =

     0     1     0

See Also

char | is* | isa | iscellstr | isletter | isnumeric | isspace | isstrprop | strings

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS