how to display a word in a format

2 次查看(过去 30 天)
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