how to display a word in a format

조회 수: 2 (최근 30일)
Elysi Cochin
Elysi Cochin 2012년 12월 4일
i have a word... i want to delete the last three alphabets of the word... what shud i do... also if the word has any underscore or full stop it should also be deleted.... please do reply...
if the word is "matlab_ans.wer" it should display "matlab ans" if the word is "matlab_ask_a_question" it should display
"matlab ask a quest"
that is delete "wer" and "ion" and insert a space in place of underscore and just delete the full stop if any...
  댓글 수: 3
Elysi Cochin
Elysi Cochin 2012년 12월 5일
sorry sir i thot of writing it as a full question... sorry sir...
Walter Roberson
Walter Roberson 2012년 12월 5일
In such cases, edit instead of starting a new question.

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

채택된 답변

Jonathan Epperl
Jonathan Epperl 2012년 12월 4일
Strings are pretty much like vectors, simply get rid of the last 3 entries:
s = s(1:end-3);
As for the rest, have a look at strrep and/or regexprep.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by