isalpha

check if variable is alphabet

You are now following this Submission

Input: string or char variable ONLY
output: is the variable consists of alphabets only
process: While MATLAB has a function named isnumeric (input = double ; output = if the variable consists of numbers only)
and isletter (input = char ; ouptut = locations where alphabets are present are marked as 1 , else 0) but what if you want to know if the complete variable consists of alphabets only? i.e you do not necessarily want to deal with 1s and 0s on indexs of the variable. What is want to use it in an if condition?

Eg: if student_name=string("Jonas") and you want to know if all such student name entries are alphabets only.
Eg2: if patient_ID=string("Martha_021") and you want to know if the initial part consists of alphabets only and not numbers. This is common mistake in medical field (I have encountered this in huge datasets).

on both the above examples you can write a statement like:
if isalpha(this_name)

else
%throw error
end

Cite As

Anmol Pardeshi (2026). isalpha (https://in.mathworks.com/matlabcentral/fileexchange/77966-isalpha), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0