MATLAB: Draw empty box by use for loop

if some one can help

if some one can help to correct this code we need function to read ch like * and width ,length from user and draw the box for 1:h disp('*') for 1:w 2:end-1 ,2:end-1 = char end end
i could not write correct code ???

Best Answer

function []=drawBox(s,w,h)% s is char
for i= 1:w
for j=1:h
if i==1||i==w||j=1||j==h
fprintf('%s \n',s) ;
else
fprintf('');
end
end
end