How to create a function of matrix with integer(from 1 to infinite) that can be arranged by row and column
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
CodeElinesa
il 23 Gen 2018
Commentato: CodeElinesa
il 23 Gen 2018
for example, if m=2, n=3 then the matrix become [1 2,3 4,5,6]' if m=4 n=4 it is [1 2 3 4,5 6 7 8,9 10 11 12,13 14 15 16]' I know I should use loop, but where should I start it? i think i may need some help here...it asks one output and two inputs.
1 Commento
Stephen23
il 23 Gen 2018
"from 1 to infinite"
Does your computer have enough memory to store an array with an infinite number of elements?
Risposta accettata
Stephen23
il 23 Gen 2018
Modificato: Stephen23
il 23 Gen 2018
Depending on the orientation you are after, either:
reshape(1:m*n,m,n)
or
reshape(1:m*n,n,m).'
3 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!