Write a MATLAB function that fills up an n by m matrix where
Write a MATLAB function that fills up an n by m matrix (where n and m are given as function input arguments) as discussed in class. For example, for n=4, and m=4, the output is a matrix like bellow:
1
5
9
13
2
6
10
14
3
7
11
15
4
8
12
16
Note that n and m are input arguments.
| 1 | 5 | 9 | 13 |
| 2 | 6 | 10 | 14 |
| 3 | 7 | 11 | 15 |
| 4 | 8 | 12 | 16 |
Solution
A=[ 1 5 9 13; 2 6 10 14; 3 7 11 15; 4 8 12 16]
