How can I split a word to parts?

4 visualizzazioni (ultimi 30 giorni)
Giorgi
Giorgi il 20 Gen 2015
Commentato: Giorgi il 20 Gen 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 Commenti
Giorgi
Giorgi il 20 Gen 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.

Accedi per commentare.

Risposta accettata

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

Accedi per commentare.

Più risposte (1)

Azzi Abdelmalek
Azzi Abdelmalek il 20 Gen 2015
b='llo'

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by