%Q1
8:2:128
writematrix(ans,'P1Q1A.txt')
%Q2
[1:4:161 161:-4:1]
writematrix(ans,'P1Q2A.txt')
%Q3
diag((4:3:151) - 3) + 3
writematrix(ans,'P1Q3A.txt')
%Q4
[diag(1:50) repmat(5, 50, 50); repmat(5, 50, 50), diag(50:-1:1)]
writematrix(ans,'P1Q4A.txt')
%Q5
m = readmatrix('P1Q5.txt')
m([15 21], [43 50])
writematrix(ans,'P1Q5A.txt')
%Q6
m(47:57, 56:66)
writematrix(ans,'P1Q6A.txt')
%Q7
m(80:-1:1, :)
writematrix(ans,'P1Q7A.txt')
%Q8
m(:, [1:54 65 56:64 55 66:end])
writematrix(ans,'P1Q8A.txt')
%Q9
m(:, 11:21) = 6
writematrix(m,'P1Q9A.txt')