Simply put:
for i=1:no %some calculations fid = fopen(['c:\out' int2str(i) '.txt'],'wt'); %write something to the file fclose(fid); end
PS. I do not believe that Matlab strings require escaping, except for '' (unless it is a format string for * printf style functions)
EDIT: see comment by @MatlabDoug
source share