フィルターのクリア

Generate a sequence/vector of randomized letters

4 ビュー (過去 30 日間)
Dan
Dan 2022 年 8 月 17 日
コメント済み: Dan 2022 年 8 月 17 日
I would like to create a 1x10 row vector of randomized letters.
My code so far is:
a='A':'Z';
letters= a(randi(numel(a), 1, 10))
letters = 'FLNRJUMDZB'
I was wondering if I could have this sequence output in a way where each letter is spaced with a comma in between. Ex: Instead of 'ABCDE', I would like'A, B, C, D, E'. Thank you to whoever can help! (Note: I am quite new to MATLAB)

採用された回答

KSSV
KSSV 2022 年 8 月 17 日
a='A':'Z';
letters= a(randi(numel(a), 1, 10))
letters = 'XMYNVGHUIL'
iwant = strjoin(cellstr(letters'),',')
iwant = 'X,M,Y,N,V,G,H,U,I,L'
  1 件のコメント
Dan
Dan 2022 年 8 月 17 日
Thank you, it was just what I was looking for! Appreciate it!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by