isletter

Marks the characters that are letters.

Category: Language Fundamentals > Data Types

Syntax

tf = isletter(A)

Returns a logical array that is true where the character of A is a letter.

Description

A character counts as a letter if it is alphabetic in the character set, which includes accented letters such as é. Digits, spaces and punctuation are not letters. isletter(A) gives the same answer as isstrprop(A, 'alpha').

Input arguments

A
Character array. Other classes give all false.

Output arguments

tf
Logical array the same size as A.

Example

Letters in a code

s = 'R2D2 ok';
isletter(s)
s(isletter(s))
Output
ans = 1×7 logical array

   1   0   1   0   0   1   1
ans = 'RDok'

See also

isspace isstrprop upper lower