Extract Last two Words from strings in cell
Afficher commentaires plus anciens
A={'There is a world of good you could perform';
'All the money in the world couldnot have saved her';
'W';
'My world'}
Réponse acceptée
Plus de réponses (1)
>> A = {'There is a world of good you could perform'; 'All the money in the world couldnot have saved her'; 'W'; 'My world'}
A =
'There is a world of good you could perform'
'All the money in the world couldnot have saved her'
'W'
'My world'
>> C = regexp(A,'(\w+\s*){1,2}$','match','once')
C =
'could perform'
'saved her'
'W'
'My world'
Catégories
En savoir plus sur Cell Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!