Problem 46716. Matrix with increasing numbers (★★★★)
Create a matrix Z with m rows and n columns that contain the numbers 1 to m*n in ascending order in the following manner. The first row will contain numbers 1 to n. The second row will contain n+1 to 2n and so on. Thus, if m = 3, n = 4, the output matrix Z will have 3 rows and 4 columns and will be the following:
[1 2 3 4;
5 6 7 8;
9 10 11 12]
This become trivial if you use loops, but do this without using loops, i.e. for/while not permitted. Additionally, the reshape command makes this very easy, so avoid that as well.
Solution CommentsShow comments
Problem Recent Solvers28