Azzera filtri
Azzera filtri

Create Unit-Spaced Matrix

1 visualizzazione (ultimi 30 giorni)
Philipp Kutschmann
Philipp Kutschmann il 17 Set 2022
Risposto: Walter Roberson il 17 Set 2022
Hi,
is there a better way to create a simple array of acsending numbers than:
foo = reshape(1:9,3,3)
foo = 3×3
1 4 7 2 5 8 3 6 9
Thanks

Risposta accettata

Walter Roberson
Walter Roberson il 17 Set 2022
No, that is the best available -- unless you want to count
foo = reshape(1:9,3,[]) %3 rows, as many colums as needed.
foo = 3×3
1 4 7 2 5 8 3 6 9
If you have the Computer Communications Toolbox, you can use
foo = buffer(1:9, 3) %3 rows
foo = 3×3
1 4 7 2 5 8 3 6 9

Più risposte (0)

Categorie

Scopri di più su Structures in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by