change a variable name
The matrix solution is cool, but if you really want to change the variable name in a loop, so use varname_1, varname_2, and so on, you'd better use eval function (write help eval in MATLAB), so, for example:
for iter=1:10
% varname_i=3*(i^2);
eval(['varname_'...