 for 1:5
 fprintf('*') % am stuck right there
does someone know how to print a square onto the command window using for loops????
i am not sure why you want to use a loop or fprintf. the simplest, but potentially not square enough solution for a filled square

 n = 5;
 x = repmat(char(42), n, n);
 disp(x);
 
 *****
 *****
 *****
 *****
 *****

for an unfilled square you can do

 n = 5;
 x = repmat(char(42), n, n);
 x(2:end-1, 2:end-1) = char(32);
 disp(x);

 *****
 * *
 * *
 * *
 *****

on my system i get a squarer square with

 x = repmat([char(42), char(32)], n, n)

 * * * * * 
 * * * * * 
 * * * * * 
 * * * * * 
 * * * * * 

depending on how perfect you want, maybe you could use a thin space or a wide space.

for a filled diamond

 a = [fliplr(tril(true(n))), tril(true(n)); triu(true(n)), fliplr(triu(true(n)))];
 x = repmat(char(32), 2*n, 2*n);
 x(a) = char(42);
 disp(x)

 ** 
 **** 
 ****** 
 ******** 
**********
**********
 ******** 
 ****** 
 **** 
 ** 


for an empty diamond

 a = [fliplr(triu(tril(true(n)))), triu(tril(true(n))); tril(triu(true(n))), fliplr(tril(triu(true(n))))];
 x = repmat(char(32), 2*n, 2*n);
 x(a) = char(42);
 disp(x)

 ** 
 * * 
 * * 
 * * 
* *
* *
 * * 
 * * 
 * * 
 ** 

if you really need to use fprintf

 y = mat2cell(x(:), ones(numel(x), 1), 1);
 fprintf([repmat('%s', 1, 2*n), '
'], y{:})
hi!

you should start reading here: <http://www.mathworks.com/help/matlab/control-flow.html> this explains how to use loops and their syntax.

what do you mean with "square"?
 clc
 
 clear
 
 n=10;
 
 a=repmat(char(42),n,n);
 
 a(1:end-1,2:end)=char(32);
 
 for i=2:10
 
 a(i,i)=char(42);
 
 end
 
 disp(a);
