isalpha

check if variable is alphabet
11 Downloads
Updated 9 Jul 2020

View License

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 (2024). isalpha (https://www.mathworks.com/matlabcentral/fileexchange/77966-isalpha), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0