# MATLAB: Naming the folders with a counter

move_to_new_folder

I used the following code to move the generated files to a new folder for every new execution.It works for the command interface .But since I am trying to create a GUI and '.exe' file for the codes, I am having problem creating a new folder with every execution as the counter value is not updated in the program memory.
c=xlsread('counter.xlsx');f=c(1)+1;newdir = sprintf('Problem_%d', c); mkdir(fullfile(newdir))movefile ('BendingMoment.png', newdir);movefile ('ShearForce.png', newdir);movefile ('Stress.png', newdir);movefile ('shaft_data.xlsx', newdir);xlswrite('counter.xlsx',f);

newdir = sprintf('Problem_%05d', c);