How can I split a word to parts?

3 vues (au cours des 30 derniers jours)
Giorgi
Giorgi le 20 Jan 2015
Commenté : Giorgi le 20 Jan 2015
Hi all, Well I want to split a word into parts for example I have sentence a='Hello World', and I want to b='llo', How can I do such thing?
  4 commentaires
Stephen23
Stephen23 le 20 Jan 2015
Modifié(e) : Stephen23 le 20 Jan 2015
Where do you want to split the words: at space characters, after the first n characters, the n final characters, after any doubled characters, two digits before any vowel character, or one of a million other rules that could explain your example output string?
Your description is inadequate.
Giorgi
Giorgi le 20 Jan 2015
I want to split at the first space character, well anyway for any sentence I want that function's output should be equal to the last three letter of the first word for a given sentence.

Connectez-vous pour commenter.

Réponse acceptée

Ilham Hardy
Ilham Hardy le 20 Jan 2015
thres = 3; %three last character of first word
a = 'Hello World';
b = strtok(a);
b = b(end-(thres-1):end);
  1 commentaire
Giorgi
Giorgi le 20 Jan 2015
Thank you very much :)

Connectez-vous pour commenter.

Plus de réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 20 Jan 2015

Catégories

En savoir plus sur Automotive dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by