Making matrix with letters

14 ビュー (過去 30 日間)
dunphy
dunphy 2021 年 11 月 13 日
編集済み: Voss 2021 年 12 月 29 日
How do I make NxN matrix using letter? This matrix should also be viewed in image.
  1 件のコメント
Jan
Jan 2021 年 11 月 13 日
The question is not clear. What does "using letter" mean? Do you want a char matrix?
A = ['ab'; 'cd']
What does "viewed as image" mean?

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

回答 (1 件)

Voss
Voss 2021 年 12 月 29 日
編集済み: Voss 2021 年 12 月 29 日
N = 50;
A = char(65+floor(26*rand(N)))
A = 50×50 char array
'TTCUQXGZXMDDTWBGCOVXSZQLFDPEGMOYCWLVJDBBNLVWNKBVOV' 'XFMWXJWDIPRZFCTVWUNQCZNTCAPMEKDDAONDDJSGZAFMAXHYZT' 'XDNMBNYKUTUPDZGUDVYUTZOCAMEEDWPLPSDWHLHXBEYZQMOCEE' 'SQFTJDWXXTNKBRINWFRWOVIYVGRVBKODXFXZLXTAKRSFKRCMRR' 'HRYLZSSVXXAXVWSLAXNQOVBZGXGDMKYSTNANJHMDUKORLSAZQV' 'ZGUKRODPJVZICKOYTLEMKBATUKYOQTYEWMHCPHNQPNTHCHVNWL' 'TXEFYREDGQZCHPLABDRJUEWSLOAQNPHMAOXFSGMKOPFSVDGAGL' 'TUNVIGBNZXLBKYZJOHHVSMLZVZZRVAEWAEBHEWJRNZTIFWWHRV' 'QBGXRTMMCVKIARTXWUDDHWAVRVVHLTYELKNVEGXZDZENBUYDXC' 'LRKZJBZXBREABTYRUHZXUYEUCITTRURXYWYKEETNPJUPTSRFMF' 'WPAKELAHZBEFBOUATIQAGUEPRQVYSWMMOQSJUQKBRKVKTRMSWV' 'WAQMBUVQMQZKTKFBUFVHDXLXJZPGCQOUCEAMBZOOJFRAWWDAMF' 'EOLSWMJSCUJEVIUTYTWYPIDFJEIYFPSDGIQSSGCPFBLMAQESTU' 'MEPDNIJQUUJZHNJJXZURNAXTYLLWYLNPLAFAQUOMLYWDWSLMLK' 'BICQFPHOKPGFBNGYFQJWFKU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FSDPYMAONXINQBITJVQTKMILIYYJMRFGIOZGX' 'QCDSSIHAENCZFWQHJAJBEAETTHIFDZYCFBDCJLTXMTMCIBLLCF' 'DQONDQBISKIRZNNBPXGXDTYLYOWGABFLRCMYFEPDFUGECFSBJR' 'PHXMOLLYQCTHHWOKJISDNLTKEQMIRXTMGIVFIOXDRXSXYDZOII' 'DOSQXNYAUEXAFNODFZVIBMCKYZEXWWUMDTRQDAYHDJUYRYOPBS' 'XVUEIPQEPRPETYISVRMEIPJOBAUPPTSEYNZMCPVXALTSQRTGLZ' 'KMBMYXYJIJJNXMMXCVRJKEHXIVCPVOQBLYGPQVBVRESLWNPELB' 'XQADIZVCUABBYGFKQLIQYQQDJASNMCIKEPONLPKSVNIJBLXHJM' 'RWAXKDUBCEECXMCGYJJTECJZFDXCPQSRVGDTHGIFQPFOPEPCVM' 'ZVBOTABWKYNMRPSQVGFIIEXUOBACEESLPIEZFMLDZBOTDYKQWX' 'SYAIAJFQQCJWKJBLWEUDAZIYCHKNJSSMCZEKWTHLSCHFLLMMTB' 'HNPUKZWNZQGAOQVJKWARDYNDYSTUIMCDXNNNUCRIUXPFTOKDYA' 'ENFIQIELWBXJQSPSJHORWMLTFSHTQDIJAZFBNINERBGEQHMVZO' 'UWFWXSZAYNSEZGDXHHBBAUOLMIWINTKEBZLWWXWDKXRSURSDER' 'URLIEJEPUMZWNXOVTARKZKZFKJEUUDGCJZSKCIUUWCSZRWREIY' 'DISNAYHZASLQKRYPPFYYUVHEZGWTGIABQOUCZDKDBXZFNWLOWA'
figure();
[X,Y] = meshgrid(1:N,1:N);
text(X(:),Y(:),num2cell(A),'FontSize',6);
set(gca(),'XLim',[0 N+1],'YLim',[0 N+1],'YDir','reverse','Visible','off');

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by