Embedding after every odd letter

1 回表示 (過去 30 日間)
Balkar Singh
Balkar Singh 2020 年 4 月 14 日
コメント済み: Balkar Singh 2020 年 4 月 15 日
I want to embed data after every odd letter of a word. For example Most is my text and I want to embed 202D. Expected output M202Dos202Dt.
  1 件のコメント
Balkar Singh
Balkar Singh 2020 年 4 月 14 日
Thanks in advance

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2020 年 4 月 14 日
This is quirky enough that I suspect it's homework, though you did not tag it as such. And since we're not supposed to do your homework for you (so you don't get into cheating trouble with your institution/teacher) I suggest you just look at my solution to your other, very similar question here : Click here
Then figure out how to modify only the odd numbered indexes. Hint:
for k = 1 : 2 : length(words) % Loop to do words 1, 3, 5, etc.
thisWord = words{k}
end
  3 件のコメント
Image Analyst
Image Analyst 2020 年 4 月 15 日
Yes, my code here gets only the odd words, then you can insert your special character like I showed you before in the other post:
thisWord = sprintf('%s%c%c', thisWord(1:end-1), yourSpecialCharacter, thisWord(end));
Balkar Singh
Balkar Singh 2020 年 4 月 15 日
Thanks sir..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by