MATLAB: Diary, how to create a new one

diary

I have a .m file I want to save the text at the command window. Next time I run the m-file I want to create a new diary file. This however seem to be problematic. I try to save the diary with a new filename but I get the message that the file doesn't exist.
Any idea how to solve this?

Best Answer

could you paste the value for savdir and ['file_',mfilename,myFolder(53:end),'diary.txt']?
also execute fullfile(savdir,['file_',mfilename,myFolder(53:end),'diary.txt']) and check if that runs ok.