This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Determine which characters are letters


TF = isletter(A)



TF = isletter(A) returns a logical array TF. If A is a character array or string scalar, then the elements of TF are logical 1 (true) where the corresponding characters in A are letters, and logical 0 (false) elsewhere.

If A is not a character array or string scalar, then isletter returns logical 0 (false).


collapse all

Create different arrays, and then determine which array elements are letters.

chr = '123 Main St.'
chr = 
'123 Main St.'
TF = isletter(chr)
TF = 1x12 logical array

   0   0   0   0   1   1   1   1   0   1   1   0

Starting in R2016b, you can convert character arrays to strings using the string function. Convert chr to a string, and test it. The input argument is not a character array, so isletter returns 0.

str = string(chr)
str = 
"123 Main St."
TF = isletter(str)
TF = 1x12 logical array

   0   0   0   0   1   1   1   1   0   1   1   0

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array. A can be any data type.


To find letters within elements of a nonscalar string array, use the isstrprop function.

Extended Capabilities

Introduced before R2006a