% Solution 4-20.e for index = 1:length(n) if n(index) m(index) = 2; else m(index) = -1; end end