Iterations of copyfile function across files
7 ビュー (過去 30 日間)
I have 4 files (S001, S002, S003, S004) in the following path
Each file has a subfloder "rest_ctrl".
Aim: To copy and paste the files insde each file (indexed with the 'a*') in a different folder.
I defined the source and destination folders as follows:
Participant = 'S001';
SourceFolder = fullfile([SourcePath,Participant],'rest_ctrl');
And the destination folder as follows:
DistFolder = fullfile(DistPath,'S001');
The code works fine when I use the "copyfile" function subjectwise:
How can I iterate it in order to have all the content of the source files (i.e., S001/ rest_ctrl/a... S004/ rest_ctrl/a...) in the destination folder?
Thanks in advance
Abhijeet 2022 年 7 月 12 日
Hi Julian Gaviria,
I can understand that you want to do similar file operations on multiple file using for loop.
Please refer to this basic code template.
Here do_file_operation function takes in the file name like S001 and performs the required operation .
Participant = 'S00';
%function for performing file operation