Info
This question is closed. Reopen it to edit or answer.
How can I set a variable to be the last alphabetical letter found in a text string?
1 view (last 30 days)
Show older comments
For example, if TS1='$35gh6', how would i be able to make an output display 'h', since it is the last alphabetical letter found in the text string. This is assuming I didnt know what was in the text string. I need to just find the last letter and display it no matter what the text string i.
0 Comments
Answers (1)
Star Strider
on 24 Jan 2016
Use regexp:
TS1='$35gh6';
LastLetter = TS1(max(regexp(TS1, '[A-Za-z]')))
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!