% Lab/Exercise 4 Solution a) x = floor(rand(2,3)*10) b) x.^2 c) x' [rows cols] = size(x) y = zeros(3,2); for ii=1:rows for jj=1:cols y(jj,ii)=x(ii,jj) end end d) x([1 2],:) = x([2,1],:) e) x(:,3) = x(2,[2 1])' f) tmp = input('Enter a string: ','s'); vals = ((tmp >= 'A') & (tmp <= 'Z')) | ... ((tmp >= 'a') & (tmp <= 'z')) s = tmp(vals)