matrix generation 1 to n*n or interval
Afficher commentaires plus anciens
hi guys i have a problem.. how can i generate a matrix n*n with 1 to n*n elements or any other interval? like for a 3x3 1 2 3 ; 4 5 6 ; 7 8 9 ( i don't want to type it directly i want to generate it knowing n ). Thank you.
Réponse acceptée
Plus de réponses (1)
n=10;
a=1:n*n;
out=reshape(a,n,n)'
Catégories
En savoir plus sur MATLAB Coder dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!