Clear Filters
Clear Filters

extracting numeric vulues from cell char

2 views (last 30 days)
hello every one; who can help me how to extract these email addresses from numeric values which placed before @ character:
km={'ibadal202@gmail.com';'qzaman@msn.com';'dfoorno020@msn.com';'myey@hotmail.com';'qkemal@myspace.com';'zvarfi1013@gmail.com';'vlul010@mynet.com';'uwardo@msn.com';'izaman@hotmail.com';'htimiro@myspace.com';'mfoorno@hotmail.com';'uelo@hotmail.com'}
thanks in advance.

Accepted Answer

Guillaume
Guillaume on 14 May 2015
Regular expressions are very good for this:
km = {'ibadal202@gmail.com'
'qzaman@msn.com'
'dfoorno020@msn.com'
'myey@hotmail.com'
'qkemal@myspace.com'
'zvarfi1013@gmail.com'
'vlul010@mynet.com'
'uwardo@msn.com'
'izaman@hotmail.com'
'htimiro@myspace.com'
'mfoorno@hotmail.com'
'uelo@hotmail.com'};
numasstring = regexp(km, '\d+(?=@)', 'match', 'once') %find sequence of digits immediately followed by @.
numbers = cellfun(@str2double, numasstring)

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!