Removing Letters from String of Letters and Numbers

3 views (last 30 days)
Hello,
I have 60,000+ rows of values in a table.
I have a serial number row that has 60,000 serial numbers.
Example: "XYZ123456789123".
All serial numbers start with XYZ. How do I create a column next to it with only the last 12 numbers in it for all 60,000 rows?
Thanks!

Accepted Answer

Cris LaPierre
Cris LaPierre on 22 Mar 2021
You could use extractAfter
s=["XYZ123456789123";"XYZ123456789126"]
s = 2×1 string array
"XYZ123456789123" "XYZ123456789126"
% use postion
n1=extractAfter(s,3)
n1 = 2×1 string array
"123456789123" "123456789126"
% Use pattern
n2=extractAfter(s,"XYZ")
n2 = 2×1 string array
"123456789123" "123456789126"

More Answers (0)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!