How can I split a word to parts?

6 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2015-1-20
编辑:Stephen23 2015-1-20
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 2015-1-20
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.

请先登录,再进行评论。

采纳的回答

Ilham Hardy
Ilham Hardy 2015-1-20
thres = 3; %three last character of first word
a = 'Hello World';
b = strtok(a);
b = b(end-(thres-1):end);

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2015-1-20

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by