Create Unit-Spaced Matrix

1 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2022-9-17
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by