An N by N by N matrix code
787 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
dunphy
le 11 Nov 2021
Modifié(e) : MathWorks Support Team
le 7 Oct 2025 à 12:39
How do I code for N x N x N matrix using a letter.
0 commentaires
Réponse acceptée
KSSV
le 7 Oct 2025 à 0:00
Modifié(e) : MathWorks Support Team
le 7 Oct 2025 à 12:39
text(0.5,0.5,'D','FontSize',90,'Color','k')
axis off
I=frame2im(getframe(gcf));
iwant = imresize(I,[50 50]) ;
imshow(iwant)
5 commentaires
Spaceman
le 6 Mar 2024
text adds text to one point, specifying x and y as scalars. i.e. (0.5,0.5)
'D' is what appears in the image.
'Fontsize',90 specifies how large the D will be.
'Color','k' dictates the D will be black.
Walter Roberson
le 2 Oct 2025 à 16:54
@KSSV I do not understand how this solution is intended to produce an N x N x N matrix. At most it produces a 50 x 50 x 3 matrix, but 50 x 50 x 3 is very different than 50 x 50 x 50.
Plus de réponses (3)
Walter Roberson
le 23 Sep 2025
N = 20; %for example
Letter = 'D'; %for example
Array3d = repmat(Letter, N, N, N);
0 commentaires
DGM
le 23 Sep 2025
For sake of ridiculousness:
N = double('d'); % using a letter
myarray = zeros(N,N,N); % a NxNxN array
size(myarray)
Yes, I did think about creating a volumetric image of a letter, but I'm lazy today.
0 commentaires
Magisha
le 2 Oct 2025 à 11:58
imshow(iwant)
1 commentaire
Walter Roberson
le 2 Oct 2025 à 16:52
This is the final line from @KSSV answer, and does not make any sense without the previous code posted by KSSV.
Voir également
Catégories
En savoir plus sur Data Type Conversion dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!