Untitled
A1 = [1 2 3; 4 5 6; 7 8 9]; L1 = matricePariDispari(A1); disp(L1); function L = matricePariDispari(A) [nr nc] = size(A); L = zeros(nr, nc); for i = 1:nr for j = 1:nc if rem(A(i,j), 2) == 0 L(i,j) = 1; else L(i,j) = 0; end end end end
Leave a Comment