function result = boxOfx(width) %boxOfx return a square made up of the letter x % % consumes: width, a scalar number indicating how many times % the letter x should appear % produces: a square box made up of the letter x % % if x <= 0, an empty string is returned % % Examples: % >> boxOfx(3) % ans = % % xxx % xxx % xxx % % >> boxOfx(5) % ans = % % xxxxx % xxxxx % xxxxx % xxxxx % xxxxx % % >> boxOfx(-10) % ans = % '' % >> % P. Conrad for CISC106, 10/07/2007 result = []; % set result to the empty matrix for i=1:width result = [ result ; lineOfx(width) ]; %add a row end; return; end % function boxOfx