Home Matlab: for loop and sprintf combination
 I have the following data: no_gridpoints = 640 % amount of columns in considered surfaceelevation % a 1x640 array with surface elevation Terskol1752, Terskol1753, ... Terskol2017 % 365x1 arrays with daily mean temperatures for 1 year of which the fifth colomn contains the temperature data  I want to create temp_glacier files with the corresponding year in the file name. This with a loop over all the years (1752-2017) by using the sprintf command in the loop: for k = 1752:2017 for m = 1:no_gridpoints sprintf('temp_glacier%d(m)',k) = sprintf('Terskol%d(:,5)',k) + surfaceelevation end end  However, I always get the error 'Subscripted assignment dimension mismatch.'. Can anyone tell me what I am doing wrong? Thanks