⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rri_changepath_ui.m

📁 绝对经典,老外制作的功能强大的matlab实现PLS_TOOBOX
💻 M
📖 第 1 页 / 共 3 页
字号:
            [upper(st_sessionFile(1)) st_sessionFile(2:end)];
         st_sessionFile = strrep(st_sessionFile,oldpath,newpath);
         if strcmp(systype,'pc2ux')
            st_sessionFile = strrep(st_sessionFile,'\','/');
         elseif strcmp(systype,'ux2pc')
            st_sessionFile = strrep(st_sessionFile,'/','\');
         end

         save(filename,'-append','st_sessionFile');

      elseif ~isempty(findstr('fMRIresult.mat', filename))

         load(filename, 'SessionProfiles');

         if get(select_all_file_hdl,'value') & strcmp(org_oldpath,'Varied')
            oldpath = rri_fileparts(SessionProfiles{1}{1});
         end
         oldpath = [upper(oldpath(1)) oldpath(2:end)];
         if isempty(findstr(oldpath, filesep))
            if getappdata(gcf,'ispc')
               systype = 'ux2pc';
            else
               systype = 'pc2ux';
            end
         end

         for i = 1:length(SessionProfiles)
            for j = 1:length(SessionProfiles{i})
               SessionProfiles{i}{j} = ...
                  [upper(SessionProfiles{i}{j}(1)) SessionProfiles{i}{j}(2:end)];
               SessionProfiles{i}{j} = ...
                  strrep(SessionProfiles{i}{j},oldpath,newpath);
               if strcmp(systype,'pc2ux')
                  SessionProfiles{i}{j} = strrep(SessionProfiles{i}{j},'\','/');
               elseif strcmp(systype,'ux2pc')
                  SessionProfiles{i}{j} = strrep(SessionProfiles{i}{j},'/','\');
               end
            end
         end

         save(filename,'-append','SessionProfiles');

      elseif ~isempty(findstr('BfMRIsession.mat', filename))

         load(filename, 'session_info');

         if get(select_all_file_hdl,'value') & strcmp(org_oldpath,'Varied')
            oldpath = session_info.pls_data_path;
         end
         oldpath = [upper(oldpath(1)) oldpath(2:end)];
         if isempty(findstr(oldpath, filesep))
            if getappdata(gcf,'ispc')
               systype = 'ux2pc';
            else
               systype = 'pc2ux';
            end
         end

         session_info.pls_data_path = ...
            [upper(session_info.pls_data_path(1)) session_info.pls_data_path(2:end)];
         session_info.pls_data_path = ...
               strrep(session_info.pls_data_path,oldpath,newpath);
         if strcmp(systype,'pc2ux')
            session_info.pls_data_path = ...
               strrep(session_info.pls_data_path,'\','/');
         elseif strcmp(systype,'ux2pc')
            session_info.pls_data_path = ...
               strrep(session_info.pls_data_path,'/','\');
         end

         for j = 1:session_info.num_runs
            session_info.run(j).data_path = ...
               [upper(session_info.run(j).data_path(1)) session_info.run(j).data_path(2:end)];
            session_info.run(j).data_path = ...
		strrep(session_info.run(j).data_path,oldpath,newpath);
            if strcmp(systype,'pc2ux')
               session_info.run(j).data_path = ...
                  strrep(session_info.run(j).data_path,'\','/');
            elseif strcmp(systype,'ux2pc')
               session_info.run(j).data_path = ...
                  strrep(session_info.run(j).data_path,'/','\');
            end
         end

         save(filename,'-append','session_info');

      elseif ~isempty(findstr('BfMRIdatamat.mat', filename))

         load(filename, 'st_sessionFile');

         if get(select_all_file_hdl,'value') & strcmp(org_oldpath,'Varied')
            oldpath = rri_fileparts(st_sessionFile);
         end
         oldpath = [upper(oldpath(1)) oldpath(2:end)];
         if isempty(findstr(oldpath, filesep))
            if getappdata(gcf,'ispc')
               systype = 'ux2pc';
            else
               systype = 'pc2ux';
            end
         end

         st_sessionFile = ...
            [upper(st_sessionFile(1)) st_sessionFile(2:end)];
         st_sessionFile = strrep(st_sessionFile,oldpath,newpath);
         if strcmp(systype,'pc2ux')
            st_sessionFile = strrep(st_sessionFile,'\','/');
         elseif strcmp(systype,'ux2pc')
            st_sessionFile = strrep(st_sessionFile,'/','\');
         end

         save(filename,'-append','st_sessionFile');

      elseif ~isempty(findstr('BfMRIresult.mat', filename))

         load(filename, 'SessionProfiles');

         if get(select_all_file_hdl,'value') & strcmp(org_oldpath,'Varied')
            oldpath = rri_fileparts(SessionProfiles{1}{1});
         end
         oldpath = [upper(oldpath(1)) oldpath(2:end)];
         if isempty(findstr(oldpath, filesep))
            if getappdata(gcf,'ispc')
               systype = 'ux2pc';
            else
               systype = 'pc2ux';
            end
         end

         for i = 1:length(SessionProfiles)
            for j = 1:length(SessionProfiles{i})
               SessionProfiles{i}{j} = ...
                  [upper(SessionProfiles{i}{j}(1)) SessionProfiles{i}{j}(2:end)];
               SessionProfiles{i}{j} = ...
		  strrep(SessionProfiles{i}{j},oldpath,newpath);
               if strcmp(systype,'pc2ux')
                  SessionProfiles{i}{j} = strrep(SessionProfiles{i}{j},'\','/');
               elseif strcmp(systype,'ux2pc')
                  SessionProfiles{i}{j} = strrep(SessionProfiles{i}{j},'/','\');
               end
            end
         end

         save(filename,'-append','SessionProfiles');

      elseif ~isempty(findstr('ERPsession.mat', filename))

         load(filename, 'session_info');

         if get(select_all_file_hdl,'value') & strcmp(org_oldpath,'Varied')
            oldpath = session_info.pls_data_path;
         end
         oldpath = [upper(oldpath(1)) oldpath(2:end)];
         if isempty(findstr(oldpath, filesep))
            if getappdata(gcf,'ispc')
               systype = 'ux2pc';
            else
               systype = 'pc2ux';
            end
         end

         session_info.pls_data_path = ...
            [upper(session_info.pls_data_path(1)) session_info.pls_data_path(2:end)];
         session_info.pls_data_path = ...
               strrep(session_info.pls_data_path,oldpath,newpath);
         if strcmp(systype,'pc2ux')
            session_info.pls_data_path = ...
               strrep(session_info.pls_data_path,'\','/');
         elseif strcmp(systype,'ux2pc')
            session_info.pls_data_path = ...
               strrep(session_info.pls_data_path,'/','\');
         end

         for j = 1:session_info.num_subjects
            session_info.subject{j} = ...
               [upper(session_info.subject{j}(1)) session_info.subject{j}(2:end)];
            session_info.subject{j} = ...
		strrep(session_info.subject{j},oldpath,newpath);
            if strcmp(systype,'pc2ux')
               session_info.subject{j} = ...
                  strrep(session_info.subject{j},'\','/');
            elseif strcmp(systype,'ux2pc')
               session_info.subject{j} = ...
                  strrep(session_info.subject{j},'/','\');
            end
         end

         save(filename,'-append','session_info');

      elseif ~isempty(findstr('ERPdatamat.mat', filename))

         load(filename, 'session_info','session_file','datafile');

         if get(select_all_file_hdl,'value') & strcmp(org_oldpath,'Varied')
            oldpath = session_info.pls_data_path;
         end
         oldpath = [upper(oldpath(1)) oldpath(2:end)];
         if isempty(findstr(oldpath, filesep))
            if getappdata(gcf,'ispc')
               systype = 'ux2pc';
            else
               systype = 'pc2ux';
            end
         end

         session_info.pls_data_path = ...
            [upper(session_info.pls_data_path(1)) session_info.pls_data_path(2:end)];
         session_info.pls_data_path = ...
               strrep(session_info.pls_data_path,oldpath,newpath);
         if strcmp(systype,'pc2ux')
            session_info.pls_data_path = ...
               strrep(session_info.pls_data_path,'\','/');
         elseif strcmp(systype,'ux2pc')
            session_info.pls_data_path = ...
               strrep(session_info.pls_data_path,'/','\');
         end

         for j = 1:session_info.num_subjects
            session_info.subject{j} = ...
               [upper(session_info.subject{j}(1)) session_info.subject{j}(2:end)];
            session_info.subject{j} = ...
		strrep(session_info.subject{j},oldpath,newpath);
            if strcmp(systype,'pc2ux')
               session_info.subject{j} = ...
                  strrep(session_info.subject{j},'\','/');
            elseif strcmp(systype,'ux2pc')
               session_info.subject{j} = ...
                  strrep(session_info.subject{j},'/','\');
            end
         end

         session_file = ...
            [upper(session_file(1)) session_file(2:end)];
         session_file = strrep(session_file,oldpath,newpath);
         if strcmp(systype,'pc2ux')
            session_file = strrep(session_file,'\','/');
         elseif strcmp(systype,'ux2pc')
            session_file = strrep(session_file,'/','\');
         end
         datafile = ...
            [upper(datafile(1)) datafile(2:end)];
         datafile = strrep(datafile,oldpath,newpath);
         if strcmp(systype,'pc2ux')
            datafile = strrep(datafile,'\','/');
         elseif strcmp(systype,'ux2pc')
            datafile = strrep(datafile,'/','\');
         end

         save(filename,'-append','session_info','session_file','datafile');

      elseif ~isempty(findstr('ERPresult.mat', filename))

         load(filename, 'datamat_files');

         if get(select_all_file_hdl,'value') & strcmp(org_oldpath,'Varied')
            oldpath = rri_fileparts(datamat_files{1});
         end
         oldpath = [upper(oldpath(1)) oldpath(2:end)];
         if isempty(findstr(oldpath, filesep))
            if getappdata(gcf,'ispc')
               systype = 'ux2pc';
            else
               systype = 'pc2ux';
            end
         end

         for j = 1:length(datamat_files)
            datamat_files{j} = ...
               [upper(datamat_files{j}(1)) datamat_files{j}(2:end)];
            datamat_files{j} = strrep(datamat_files{j},oldpath,newpath);
            if strcmp(systype,'pc2ux')
               datamat_files{j} = strrep(datamat_files{j},'\','/');
            elseif strcmp(systype,'ux2pc')
               datamat_files{j} = strrep(datamat_files{j},'/','\');
            end
         end

         save(filename,'-append','datamat_files');

      end

   end			% for i=1:length(filt_list)

   set(gcf,'Pointer',old_pointer);		% Put 'Arrow' pointer back

   if length(file_list) > 1
      close(progress_hdl);
   end

   if 1		% ~strcmp(org_oldpath,'Varied')
      set(old_path_edit_hdl,'string',newpath);
   end

   return;					% select_save


%----------------------------------------------------------------------------
function click_select

   file_list_hdl = findobj(gcf,'Tag','FILE_LIST');
   select_a_file_hdl = findobj(gcf,'Tag','SELECT_A_FILE');
   select_all_file_hdl = findobj(gcf,'Tag','SELECT_ALL_FILE');
   old_path_edit_hdl = findobj(gcf,'tag','OldPathEdit');
   new_path_edit_hdl = findobj(gcf,'tag','NewPathEdit');
   dir_name = get(file_list_hdl,'user');

   file_list = get(file_list_hdl,'string');
   file_list = file_list(get(file_list_hdl,'value'));

   progress_hdl = rri_progress_ui('initialize', 'Searching PLS path, please wait ...');

   old_pointer = get(gcf,'Pointer');
   set(gcf,'Pointer','watch');

   path_lst = {};

   for i = 1:length(file_list)

      filename = fullfile(dir_name, file_list{i});

      msg = ['Working on file: ', filename];
      rri_progress_ui(progress_hdl, '', msg);
      rri_progress_ui(progress_hdl, '', i/length(file_list));

      if ~isempty(findstr('PETsession.mat', filename))

         load(filename, 'session_info');

         path_lst = [path_lst; {session_info.pls_data_path}];

         for j = 1:session_info.num_subjects
            path_lst = [path_lst; {session_info.subject{j}}];
         end

      elseif ~isempty(findstr('PETdatamat.mat', filename))

         load(filename, 'session_info','session_file');

         path_lst = [path_lst; {session_info.pls_data_path}];

         for j = 1:session_info.num_subjects
            path_lst = [path_lst; {session_info.subject{j}}];
         end

         path_lst = [path_lst; {fileparts(session_file)}];

      elseif ~isempty(findstr('PETresult.mat', filename))

         load(filename, 'datamat_files');

         for j = 1:length(datamat_files)
            path_lst = [path_lst; {fileparts(datamat_files{j})}];
         end

      elseif ~isempty(findstr('fMRIsession.mat', filename))

         load(filename, 'session_info');

         path_lst = [path_lst; {session_info.pls_data_path}];

         for j = 1:session_info.num_runs
            path_lst = [path_lst; {session_info.run(j).data_path}];
         end

      elseif ~isempty(findstr('fMRIdatamat.mat', filename))

         load(filename, 'st_sessionFile');

         path_lst = [path_lst; {fileparts(st_sessionFile)}];

      elseif ~isempty(findstr('fMRIresult.mat', filename))

         load(filename, 'SessionProfiles');

         for i = 1:length(SessionProfiles)
            for j = 1:length(SessionProfiles{i})
               path_lst = [path_lst; {fileparts(SessionProfiles{i}{j})}];
            end
         end

      elseif ~isempty(findstr('BfMRIsession.mat', filename))

         load(filename, 'session_info');

         path_lst = [path_lst; {session_info.pls_data_path}];

         for j = 1:session_info.num_runs
            path_lst = [path_lst; {session_info.run(j).data_path}];
         end

      elseif ~isempty(findstr('BfMRIdatamat.mat', filename))

         load(filename, 'st_sessionFile');

         path_lst = [path_lst; {fileparts(st_sessionFile)}];

      elseif ~isempty(findstr('BfMRIresult.mat', filename))

         load(filename, 'SessionProfiles');

         for i = 1:length(SessionProfiles)
            for j = 1:length(SessionProfiles{i})
               path_lst = [path_lst; {fileparts(SessionProfiles{i}{j})}];
            end
         end

      elseif ~isempty(findstr('ERPsession.mat', filename))

         load(filename, 'session_info');

         path_lst = [path_lst; {session_info.pls_data_path}];

         for j = 1:session_info.num_subjects
            path_lst = [path_lst; {session_info.subject{j}}];
         end

      elseif ~isempty(findstr('ERPdatamat.mat', filename))

         load(filename, 'session_info','session_file','datafile');

         path_lst = [path_lst; {session_info.pls_data_path}];

         for j = 1:session_info.num_subjects
            path_lst = [path_lst; {session_info.subject{j}}];
         end

         path_lst = [path_lst; {fileparts(session_file)}];
         path_lst = [path_lst; {fileparts(datafile)}];

      elseif ~isempty(findstr('ERPresult.mat', filename))

         load(filename, 'datamat_files');

         for j = 1:length(datamat_files)
            path_lst = [path_lst; {fileparts(datamat_files{j})}];
         end

      end

   end			% for i=1:length(filt_list)

   set(gcf,'Pointer',old_pointer);		% Put 'Arrow' pointer back

   close(progress_hdl);

   %  display select window
   %
   oldpath = rri_getselectstr(unique(sort(path_lst)));

   if ~isempty(oldpath)
      set(old_path_edit_hdl,'string',oldpath);
   end

   return;					% click_select

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -