MATLAB: How to add a variable index to a file name in a loop

variable index

I would like to make it so every time this runs, for J=1:15, it saves a different version of the function minfun with the index j appended. Here is the relevant section of code.
*for j=1:15
Minsum=minimize6(D0,D1,D2,D3,D4,D5,D6,D7,D8,Data104trans(j,3:13));
matlabFunction(Minsum,'file','minfuntj');
[x1,x2,x3,x4,x5,x6,x7,x8,x9,fval]=loop5(@minfuntj,1,1,1,1,1,1,1,1,1);

Best Answer

functionName = sprintf('minfunt%d', j);
matlabFunction(Minsum,'file', functionName);