Generate the following matrix without typing in each individ
Solution
A=[1:2:7;14:14:56;7.*ones(1,4);15:11:48];
disp(\'matrix\')
A=A\'
disp(\'A(2,3)\')
A(2,3)
disp(\'A(1,4)\')
A(1,4)
disp(\'all rows 2nd column\')
A(1:end,2)
disp(\'all rows 2nd column\')
A(3,1:end)
disp(\'2nd,4th row, all columns\');
A([2 4],1:end)
disp(\'all rows of 1st an 4th column\')
A(1:end,[1 4])
disp(\'2nd to 4th rows of 1st to 3rd column\');
A(2:4,1:3)
disp(\'2nd to 3rd rows of 2nd to 3rd column\');
A(2:3,2:3)
disp(\'1,4 rows of 2,4 columns\');
A([1 4],[2 4])
>> m18
matrix
A =
1 14 7 15
3 28 7 26
5 42 7 37
7 56 7 48
A(2,3)
ans =
7
A(1,4)
ans =
15
all rows 2nd column
ans =
14
28
42
56
all rows 2nd column
ans =
5 42 7 37
2nd,4th row, all columns
ans =
3 28 7 26
7 56 7 48
all rows of 1st an 4th column
ans =
1 15
3 26
5 37
7 48
2nd to 4th rows of 1st to 3rd column
ans =
3 28 7
5 42 7
7 56 7
2nd to 3rd rows of 2nd to 3rd column
ans =
28 7
42 7
1,4 rows of 2,4 columns
ans =
14 15
56 48
>>

