How to use isletter() In MATLAB

The isletter() function is used to find the array of elements that are letters of the alphabet.

Syntax:

isletter(‘string’)

Here, isletter(‘string’) is used to return an array the same size as the specified “string” that contains logical true i.e. 1 when the elements of “string” are letters of the alphabet, and logical false i.e. 0 when they are not.

Example 

Matlab




% MATLAB code for isletter() demonstration
% Initializing a cell array
A = {'gfg'; 'gfg1.23GFG'; '5gfg'};
  
% Calling the cat() function to
% concatenate the data of the above
% cell array into a single string
% one after another
S = cat(2, A{:});
  
% Calling the isletter() function
% to filter the numeric value 
S(isletter(S)) = []


Output:

S = 1.235


How to extract numbers from cell array in MATLAB?

In this article, we are going to discuss the extraction of numbers from the cell array with the help of regexp(), str2double(), cat(), and isletter() functions.

Similar Reads

What is a Cell Array?

A cell array is nothing but a data type having indexed data containers called cells, where each cell contains any type of data. It mainly contains either a list of texts, combinations of text and numbers, or numeric arrays of different sizes....

Using regexp( )

...

Using str2double( )

The regexp() function is used for matching the regular expression. It is case-sensitive....

Using cat()

...

Using isletter()

The str2double() function is used for the conversion of strings to double-precision values....