What you're trying to do is a bad idea ( https://in.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval )
As = cell(n,1);
for k = 1:n
As{k} = ... your code
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!