Making matrix with letters

16 visualizaciones (últimos 30 días)
dunphy
dunphy el 13 de Nov. de 2021
Editada: Voss el 29 de Dic. de 2021
How do I make NxN matrix using letter? This matrix should also be viewed in image.
  1 comentario
Jan
Jan el 13 de Nov. de 2021
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?

Iniciar sesión para comentar.

Respuestas (1)

Voss
Voss el 29 de Dic. de 2021
Editada: Voss el 29 de Dic. de 2021
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' 'BICQFPHOKPGFBNGYFQJWFK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ZFSDPYMAONXINQBITJVQTKMILIYYJMRFGIOZGX' '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');

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by