how to build a character array to show letters that appear multiple times in a word

2 ビュー (過去 30 日間)
zoom
zoom 2019 年 5 月 5 日
回答済み: Navdha Agarwal 2019 年 6 月 20 日
  3 件のコメント
zoom
zoom 2019 年 5 月 5 日
what i have right now is a simple dict that selects a rand word and reads in an input which is a letter. im trying to build an array that show letter inputs that appear multiply times in a word
Image Analyst
Image Analyst 2019 年 5 月 5 日
Again "A simple example is needed."
Also, put this in the body of your post, which is missing right now, AFTER you read this link.

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

回答 (1 件)

Navdha Agarwal
Navdha Agarwal 2019 年 6 月 20 日
As I understand from your question, you want to build a character array of all those letters that appear multiple times in a word. For example if your word is 'mississippi', the character array should contain 'isp'.
The code for the above logic is
v = 'mississippi';
u = unique(v);
m = [];
for i = 1:length(u)
if(length(strfind(v,u(i)))>1)
disp(u(i))
m = [m,u(i)]
end
end
disp(m)

カテゴリ

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