%Loesung für Aufgabe 8
clear all;

disp('Erzeuge Matrix A'); 
% create (5,5)-Matrix with random values in 0,...,10
A = randi([0,10],5,5)

disp('a)');
A = A - diag(diag(A))
% or
% A(logical(eye(5))) = 0
% or
% A(1:5:end) = 0

disp('b)');
% swap rows 2 and 4
A([1 4 3 2 5],:)

disp('c)'); 
% order columns from last to first
A(:,end:-1:1)


disp('d)');
% test if elements in second column are larger than their right neighbor
A(:,2)>A(:,3)




