MATLAB: Does movefile rename a file instead of moving it

MATLABmkdirmove filemovefilerename file

I have a list of files in the current folder and need to move them to another directory which contains one folder for each file.
Therefore I am doing this:
for i=1:length(edf_files) % edf_files is the cell containing the names of the files I need
this_file=edf_files{i}; % highlighting the current file (XXX.edf)
folder_name=this_file(1:end-8); % assigning a name to the relative folder (XXX)
mkdir(dl_dir, folder_name); % creating the folder in the desired directory (dl_dir)
movefile(this_file, folder_name); % moving the file to the new folder
end
But, instead of moving the file, the result is a list of renamed files in the source directory.
What can I do?

Best Answer

Solved.