Storing numeric index of alphabetic character in text string

How do I store the numeric index of the first alphabetic character in a text string? For example, TS1='%@3Gb6' returns Alpha1=4.

1 Kommentar

Stephen23
Stephen23 am 11 Feb. 2016
Bearbeitet: Stephen23 am 11 Feb. 2016
Here are two simple methods to get the indices of the alphabetic characters:
>> TS1 = '%@3Gb6';
>> regexp(TS1,'[A-Za-z]','once') % only the first
ans = 4
>> find(isstrprop(TS1,'alpha')) % all alphabetic
ans =
4 5
What do you want to do with the indices?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Jan. 2016

Beantwortet:

am 11 Feb. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by