How can I split a word to parts?

조회 수: 4 (최근 30일)
Giorgi
Giorgi 2015년 1월 20일
댓글: Giorgi 2015년 1월 20일
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
Giorgi
Giorgi 2015년 1월 20일
Thank you very much :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2015년 1월 20일

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by