clear
clc
%一、新建文件夾,
%二、將原始路徑下的數據剪切到新建文件夾中
path = ('E:\DFC_DMN_ASD_DATA_res\Cluster_hcc\4,6,8\Cluster_6\state2\ASD\');%原始數據路徑
para = ('E:\DFC_DMN_ASD_DATA_res\CorrAnalysis\cluster6\state2\data_ASD');%創建FunImg文件夾的路徑
% T1path = ('D:\Autism\USM\TD\T1Img');%創建T1Img文件夾的路徑
% mkdir(ASDpath);%創建FunImg文件夾
% mkdir(T1path);%創建T1Img文件夾
temp = dir(path);
temp = temp(3:end);
for i = 1 : length(temp)
dpath = [path,temp(i).name];
% mkdir(ASDpath,temp(i).name);%在FunImg下創建新文件夾名稱
% mkdir(T1path,temp(i).name);%在T1Img下創建新文件夾名稱
temp1 = dir(dpath);
temp1 = temp1(3:end);
newName = [temp(i).name,'_',temp1(i).name];
% copyfile([dpath,'\','*.nii'],[para,'\',newName]) %會將*.nii放在路徑下的newName文件夾里面
copyfile([dpath,'\',temp1(1).name],[para,'\',newName]);%會將.nii的名字直接改成newName (必須指定文件格式,即后綴名[.nii]),並且放在para路徑下。
end