MATLAB: Mkdir with variable name

mkdir loop l iteration variable name

Hi, i want to make directory. This directory is in a directory which name depends on a variable. How can i do this? This is part of my code.
for l=1:10
...
mkdir('c:\...\demence\' int2str(l) '\','coef')
...
end
It is not working. Thanks for help.

Best Answer

See the first example here:
You're close:
mkdir(['c:' 'c:\...\demence\' int2str(l) '\']);
or
mkdir(sprintf('c:\%i',l))