Explorar o código

Dateien hochladen nach 'Neural data/Scripts'

Thomas Kroker hai 9 meses
pai
achega
01c8fd8f41

+ 175 - 0
Neural data/Scripts/FindGameTdcsFrameChoiceFiles.m

@@ -0,0 +1,175 @@
+function DL=FindGameTdcsFiles(ParentDir,SubVec,SessVec,RunVec,InMaskChar,ExMaskChar,BatchPath)
+%	FindFiles
+
+%   EMEGS - Electro Magneto Encephalography Software
+%   ? Copyright 2005 Markus Junghoefer & Peter Peyk
+%   Implemented programs from: Andrea de Cesarei, Thomas Gruber,
+%   Olaf Hauk, Andreas Keil, Olaf Steinstraeter, Nathan Weisz
+%   and Andreas Wollbrink.
+%
+%   This program is free software; you can redistribute it and/or
+%   modify it under the terms of the GNU General Public License
+%   as published by the Free Software Foundation; either version 3
+%   of the License, or (at your option) any later version.
+%
+%   This program is distributed in the hope that it will be useful,
+%   but WITHOUT ANY WARRANTY; without even the implied warranty of
+%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%   GNU General Public License for more details.
+%   You should have received a copy of the GNU General Public License
+%   along with this program; if not, write to the Free Software
+%   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+if nargin<8; MegEegStatusVec=[]; end
+if nargin<7; BatchPath=[]; end
+if nargin<6; ExMaskChar=[]; end
+if nargin<5; InMaskChar=[]; end
+if nargin<4; RunVec=[]; end
+if nargin<3; SessVec=[]; end
+if nargin<2; SubVec=[]; end
+if nargin<1; ParentDir=[]; end
+
+%100 Ano
+%200 Cat
+
+% Trigger Codes:
+% 
+% Choice: 
+% 10 = kein Risiko eingegangen, Gain Trial (noRiskGT)
+% 11 = Risiko eingegangen, Gain Trial (riskGT)
+% 12 kein Risiko eingegangen, Loss Trial (noRiskLT)
+% 13 = Risiko eingegangen, Loss Trial (riskLT)
+% 
+% 
+% 
+% 
+% Safety: 25 = für sichere 10cent entschieden (safe10G)
+% 26 = für sichere 15cent Verlust entschieden (safe15L)
+% 35= für sichere 20cent entschieden (safe20G)
+% 36= für sichere 30cent Verlust entschieden (safe30L)
+% 45= für sichere 30cent entschieden (safe30G)
+% 46= für sichere 45cent Verlust entschieden (safe45L)
+% 55 = für sichere 40cent entschieden (safe40G)
+% 56 = für sichere 60cent Verlust entschieden (safe60L)
+% 
+% 
+% 
+% 
+% Wenn man die Risiko Option gewählt hat!
+% RiskFeedback: 
+% 21 = 25cent verloren (f25L)
+% 22 = 25cent gewonnen (f25G)
+% 31 = 50cent verloren (f50L)
+% 32 = 50cent gewonnen (f50G)
+% 41 = 75cent verloren (f75L)
+% 42 = 75cent gewonnen (f75G)
+% 51 = 100cent verloren (f100L)
+% 52 = 100cent gewonnen (f100G)
+
+
+if isempty(ExMaskChar); ExMaskChar=char(''); end
+if isempty(InMaskChar); InMaskChar=char(''); end
+if isempty(RunVec);  RunVec=[0]; end   %1 2
+if isempty(SessVec); SessVec=[1]; end  %1 2
+if isempty(SubVec);  SubVec=[42 65 66]; end  % 1 2 9 10 17 18 25 26 51 53 54 59 61 62 63 67 69 70 71 75 76 77 78 80
+
+if isempty(ParentDir); ParentDir='Z:\kroker\GameTdcsFrameBetween\MEG\GameTdcsFrameBetweenChoiceAna'; end
+if isempty(BatchPath); BatchPath='Z:\kroker\GameTdcsFrameBetween\MEG\GameTdcsFrameBetweenChoiceAna\00Batches'; end
+
+
+%ExMaskChar=char('*.mrk','*.bak','*.dsc','*.log','*.segments','BadChannels');
+
+
+%InMaskChar=char('*AEM');
+InMaskChar=char('*110','*111','*112','*113','*210','*211','*212','*213');
+%InMaskChar=char('*.at110&111&112&113.100.MN5.m4','*.at210&211&212&213.100.MN5.m4'); %Corr Expected Value
+%InMaskChar=char('*app110','*app111','*app112','*app113','*app210','*app211','*app212','*app213');
+%InMaskChar=char('*at00*');
+%InMaskChar=char('*i110','*i111','*i112','*i113'); %,'*i210','*i211','*i212','*i213');
+%InMaskChar=char('*.pmg');
+%InMaskChar=char('*.cot');
+%InMaskChar=char('*ses.ctf.*');
+
+%BatchFileChar=['at-post-gainloss-anocat']
+%BatchFileChar=['AEM']
+BatchFileChar=['Calc-MN5']
+%BatchFileChar=['App2at']
+%BatchFileChar=['Calc-MN5-ML']
+%BatchFileChar=['i-Files']
+%BatchFileChar=['Stats']
+%BatchFileChar=['pmg']
+%BatchFileChar=['cot']
+%BatchFileChar=['ses.ctf']
+%BatchFileChar=['at111-112-121-122-211-212-221-222.100.MN5.rep']
+
+StudyStr='GTB';
+
+DL=[];
+RenameStatus=0
+
+for SessIndTmp=1:length(SessVec)
+    SessInd=SessVec(SessIndTmp);
+    SessIndStr=int2str(SessInd);
+     
+    for InMaskInd=1:size(InMaskChar,1)
+        InMask=deblank(InMaskChar(InMaskInd,:))
+                
+        for SubIndTmp=1:length(SubVec)
+            SubInd=SubVec(SubIndTmp);
+            SubIndStr=int2str(SubInd);
+            if SubInd<10; 
+                SubIndStr=['C0',SubIndStr]; 
+            else
+                 SubIndStr=['C',SubIndStr];
+            end
+            
+            for RunIndTmp=1:length(RunVec)
+                RunInd=RunVec(RunIndTmp);
+                RunIndStr=int2str(RunInd);
+                if RunInd>0
+                    Path=[ParentDir,filesep,StudyStr,'-',SubIndStr,filesep,StudyStr,'-',SubIndStr,'-',SessIndStr,filesep,StudyStr,'-',SubIndStr,'-',RunIndStr,'.ds',filesep]
+                else
+                    Path=[ParentDir,filesep,StudyStr,'-',SubIndStr,filesep,StudyStr,'-',SubIndStr,'-',SessIndStr,filesep]
+                end
+                
+                PathMask=[Path,InMask]
+                D=dir(PathMask)
+                
+                for k=length(D):-1:1
+                    FilePath=[Path,D(k).name];
+                    TakeFile=1;
+                    ExMaskInd=1;
+                    while TakeFile & ExMaskInd<=size(ExMaskChar,1)
+                        ExMask=deblank(ExMaskChar(ExMaskInd,:));
+                        if ~isempty(findstr(FilePath,ExMask))
+                            TakeFile=0;
+                        end
+                        ExMaskInd=ExMaskInd+1;
+                    end
+                    if TakeFile
+                        if RenameStatus
+                            RenFilePath=[Path,StudyStr,'-',D(k).name];
+                            copyfile(FilePath,RenFilePath,'writable');
+                            delete(FilePath);
+                            FilePath=RenFilePath;
+                            RenFilePath=[];
+                        end
+                        if isempty(DL)
+                            DL=char(FilePath);
+                        else
+                            DL=char(DL,FilePath);
+                        end
+                    end
+                end
+            end
+        end
+    end
+end
+if RenameStatus; return; end
+if isempty(DL);
+    fprintf(1,['Sorry, no files with mask "',InMaskChar,'" found ...']); return;
+end
+if ~isempty(BatchPath)
+    DefBatchFilePath=[BatchPath,filesep,'Batch.',BatchFileChar,'.rep']
+    SaveFileMat(DL,[],DefBatchFilePath);
+end
+return;

+ 181 - 0
Neural data/Scripts/FindGameTdcsFrameFilesFeedback.m

@@ -0,0 +1,181 @@
+function DL=FindGameTdcsFiles(ParentDir,SubVec,SessVec,RunVec,InMaskChar,ExMaskChar,BatchPath)
+%	FindFiles
+
+%   EMEGS - Electro Magneto Encephalography Software
+%   ? Copyright 2005 Markus Junghoefer & Peter Peyk
+%   Implemented programs from: Andrea de Cesarei, Thomas Gruber,
+%   Olaf Hauk, Andreas Keil, Olaf Steinstraeter, Nathan Weisz
+%   and Andreas Wollbrink.
+%
+%   This program is free software; you can redistribute it and/or
+%   modify it under the terms of the GNU General Public License
+%   as published by the Free Software Foundation; either version 3
+%   of the License, or (at your option) any later version.
+%
+%   This program is distributed in the hope that it will be useful,
+%   but WITHOUT ANY WARRANTY; without even the implied warranty of
+%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%   GNU General Public License for more details.
+%   You should have received a copy of the GNU General Public License
+%   along with this program; if not, write to the Free Software
+%   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+if nargin<8; MegEegStatusVec=[]; end
+if nargin<7; BatchPath=[]; end
+if nargin<6; ExMaskChar=[]; end
+if nargin<5; InMaskChar=[]; end
+if nargin<4; RunVec=[]; end
+if nargin<3; SessVec=[]; end
+if nargin<2; SubVec=[]; end
+if nargin<1; ParentDir=[]; end
+
+%100 Ano
+%200 Cat
+
+% Trigger Codes:
+% 
+% Choice: 
+% 10 = kein Risiko eingegangen, Gain Trial (noRiskGT)
+% 11 = Risiko eingegangen, Gain Trial (riskGT)
+% 12 kein Risiko eingegangen, Loss Trial (noRiskLT)
+% 13 = Risiko eingegangen, Loss Trial (riskLT)
+% 
+% 
+% 
+% 
+% Safety: 25 = für sichere 10cent entschieden (safe10G)
+% 26 = für sichere 15cent Verlust entschieden (safe15L)
+% 35= für sichere 20cent entschieden (safe20G)
+% 36= für sichere 30cent Verlust entschieden (safe30L)
+% 45= für sichere 30cent entschieden (safe30G)
+% 46= für sichere 45cent Verlust entschieden (safe45L)
+% 55 = für sichere 40cent entschieden (safe40G)
+% 56 = für sichere 60cent Verlust entschieden (safe60L)
+% 
+% 
+% 
+% 
+% Wenn man die Risiko Option gewählt hat!
+% RiskFeedback: 
+% 21 = 25cent verloren (f25L)
+% 22 = 25cent gewonnen (f25G)
+% 31 = 50cent verloren (f50L)
+% 32 = 50cent gewonnen (f50G)
+% 41 = 75cent verloren (f75L)
+% 42 = 75cent gewonnen (f75G)
+% 51 = 100cent verloren (f100L)
+% 52 = 100cent gewonnen (f100G)
+
+
+if isempty(ExMaskChar); ExMaskChar=char(''); end
+if isempty(InMaskChar); InMaskChar=char(''); end
+if isempty(RunVec);  RunVec=[0]; end   %1 2
+if isempty(SessVec); SessVec=[1]; end  %1 2
+if isempty(SubVec);  SubVec=[3 5 9 13 19 21 25 29 47 51 53 55 57 59 65 6 12 14 18 26 28 42 44 46 52 54 56 60 64 66]; end %1 3 5 9 13 19 21 25 29 47 51 53 55 57 59 65 4 6 12 14 18 26 28 42 44 46 52 54 56 60 64 66  
+
+if isempty(ParentDir); ParentDir='Z:\kroker\GameTdcsFrameBetween\MEG\GameTdcsFrameBetweenFeedbackAna'; end
+if isempty(BatchPath); BatchPath='Z:\kroker\GameTdcsFrameBetween\MEG\GameTdcsFrameBetweenFeedbackAna\00Batches'; end
+
+
+%ExMaskChar=char('*.mrk','*.bak','*.dsc','*.log','*.segments','BadChannels');
+
+
+%InMaskChar=char('*AEM');
+InMaskChar=char('*at125','*at126','*at135','*at136','*at145','*at146','*at155','*at156','*at121','*at122','*at131','*at132','*at141','*at142','*at151','*at152','*at225','*at226','*at235','*at236','*at245','*at246','*at255','*at256','*at221','*at222','*at231','*at232','*at241','*at242','*at251','*at252');
+%InMaskChar=char('*at125','*at126','*at135','*at136','*at145','*at146','*at155','*at156');
+%InMaskChar=char('*at125','*at126','*at135','*at136','*at145','*at146','*at155','*at156');
+%InMaskChar=char('*at125','*at126','*at121','*at122','*at135','*at136','*at131','*at132','*at145','*at146','*at141','*at142','*at155','*at156','*at151','*at152');% CalcAvgMean4 Ano%
+%InMaskChar=char('*at225','*at226','*at221','*at222','*at235','*at236','*at231','*at232','*at245','*at246','*at241','*at242','*at255','*at256','*at251','*at252');% CalcAvgMean4 Catho
+%InMaskChar=char('*at225','*at221','*at222','*at235','*at231','*at232','*at245','*at241','*at242','*at255','*at251','*at252');% CalcAvgMean4 Catho
+%InMaskChar=char('*at226','*at236', '*at246', '*at256');
+%InMaskChar=char('*MN5');
+%InMaskChar=char('*m3b');
+%InMaskChar=char('*mn');
+%InMaskChar=char('*155*.m4b','*156*.m4b','*151*.m4b','*152*.m4b','*255*.m4b','*256*.m4b','*251*.m4b','*252*.m4b'); % Calc-MN5
+%InMaskChar=char('*app121','*app122','*app125','*app126','*app131','*app132','*app135','*app136','*app141','*app142','*app145','*app146','*app151','*app152','*app155','*app156','*app221','*app222','*app225','*app226','*app231','*app232','*app235','*app236','*app241','*app242','*app245','*app246','*app251','*app252','*app255','*app256');
+%InMaskChar=char('*at0*');
+%InMaskChar=char('*.pmg');
+%InMaskChar=char('*.cot');
+%InMaskChar=char('*ses.ctf.*');
+
+%BatchFileChar=['at-post-gainloss-anocat']
+%BatchFileChar=['AEM']
+BatchFileChar=['Calc-MN5']
+%BatchFileChar=['CalcAvgMean4']
+%BatchFileChar=['Stats']
+%BatchFileChar=['pmg']
+%BatchFileChar=['cot']
+%BatchFileChar=['ses.ctf']
+%BatchFileChar=['at111-112-121-122-211-212-221-222.100.MN5.rep']
+
+StudyStr='GTB';
+
+DL=[];
+RenameStatus=0
+
+for SessIndTmp=1:length(SessVec)
+    SessInd=SessVec(SessIndTmp);
+    SessIndStr=int2str(SessInd);
+     
+    for InMaskInd=1:size(InMaskChar,1)
+        InMask=deblank(InMaskChar(InMaskInd,:))
+                
+        for SubIndTmp=1:length(SubVec)
+            SubInd=SubVec(SubIndTmp);
+            SubIndStr=int2str(SubInd);
+            if SubInd<10; 
+                SubIndStr=['C0',SubIndStr]; 
+            else
+                 SubIndStr=['C',SubIndStr];
+            end
+            
+            for RunIndTmp=1:length(RunVec)
+                RunInd=RunVec(RunIndTmp);
+                RunIndStr=int2str(RunInd);
+                if RunInd>0
+                    Path=[ParentDir,filesep,StudyStr,'-',SubIndStr,filesep,StudyStr,'-',SubIndStr,'-',SessIndStr,filesep,StudyStr,'-',SubIndStr,'-',SessIndStr,'-',RunIndStr,'.ds',filesep]
+                else
+                    Path=[ParentDir,filesep,StudyStr,'-',SubIndStr,filesep,StudyStr,'-',SubIndStr,'-',SessIndStr,filesep]
+                end
+                
+                PathMask=[Path,InMask]
+                D=dir(PathMask)
+                
+                for k=length(D):-1:1
+                    FilePath=[Path,D(k).name];
+                    TakeFile=1;
+                    ExMaskInd=1;
+                    while TakeFile & ExMaskInd<=size(ExMaskChar,1)
+                        ExMask=deblank(ExMaskChar(ExMaskInd,:));
+                        if ~isempty(findstr(FilePath,ExMask))
+                            TakeFile=0;
+                        end
+                        ExMaskInd=ExMaskInd+1;
+                    end
+                    if TakeFile
+                        if RenameStatus
+                            RenFilePath=[Path,StudyStr,'-',D(k).name];
+                            copyfile(FilePath,RenFilePath,'writable');
+                            delete(FilePath);
+                            FilePath=RenFilePath;
+                            RenFilePath=[];
+                        end
+                        if isempty(DL)
+                            DL=char(FilePath);
+                        else
+                            DL=char(DL,FilePath);
+                        end
+                    end
+                end
+            end
+        end
+    end
+end
+if RenameStatus; return; end
+if isempty(DL);
+    fprintf(1,['Sorry, no files with mask "',InMaskChar,'" found ...']); return;
+end
+if ~isempty(BatchPath)
+    DefBatchFilePath=[BatchPath,filesep,'Batch.',BatchFileChar,'.rep']
+    SaveFileMat(DL,[],DefBatchFilePath);
+end
+return;

+ 185 - 0
Neural data/Scripts/FindGameTdcsFrameRiskFiles.m

@@ -0,0 +1,185 @@
+function DL=FindGameTdcsFiles(ParentDir,SubVec,SessVec,RunVec,InMaskChar,ExMaskChar,BatchPath)
+%	FindFiles
+
+%   EMEGS - Electro Magneto Encephalography Software
+%   ? Copyright 2005 Markus Junghoefer & Peter Peyk
+%   Implemented programs from: Andrea de Cesarei, Thomas Gruber,
+%   Olaf Hauk, Andreas Keil, Olaf Steinstraeter, Nathan Weisz
+%   and Andreas Wollbrink.
+%
+%   This program is free software; you can redistribute it and/or
+%   modify it under the terms of the GNU General Public License
+%   as published by the Free Software Foundation; either version 3
+%   of the License, or (at your option) any later version.
+%
+%   This program is distributed in the hope that it will be useful,
+%   but WITHOUT ANY WARRANTY; without even the implied warranty of
+%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%   GNU General Public License for more details.
+%   You should have received a copy of the GNU General Public License
+%   along with this program; if not, write to the Free Software
+%   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+if nargin<8; MegEegStatusVec=[]; end
+if nargin<7; BatchPath=[]; end
+if nargin<6; ExMaskChar=[]; end
+if nargin<5; InMaskChar=[]; end
+if nargin<4; RunVec=[]; end
+if nargin<3; SessVec=[]; end
+if nargin<2; SubVec=[]; end
+if nargin<1; ParentDir=[]; end
+
+%100 Ano
+%200 Cat
+
+% Trigger Codes:
+% 
+% Choice: 
+% 10 = kein Risiko eingegangen, Gain Trial (noRiskGT)
+% 11 = Risiko eingegangen, Gain Trial (riskGT)
+% 12 kein Risiko eingegangen, Loss Trial (noRiskLT)
+% 13 = Risiko eingegangen, Loss Trial (riskLT)
+% 
+% 
+% 
+% 
+% Safety: 25 = für sichere 10cent entschieden (safe10G)
+% 26 = für sichere 15cent Verlust entschieden (safe15L)
+% 35= für sichere 20cent entschieden (safe20G)
+% 36= für sichere 30cent Verlust entschieden (safe30L)
+% 45= für sichere 30cent entschieden (safe30G)
+% 46= für sichere 45cent Verlust entschieden (safe45L)
+% 55 = für sichere 40cent entschieden (safe40G)
+% 56 = für sichere 60cent Verlust entschieden (safe60L)
+% 
+% 
+% 
+% 
+% Wenn man die Risiko Option gewählt hat!
+% RiskFeedback: 
+% 21 = 25cent verloren (f25L)
+% 22 = 25cent gewonnen (f25G)
+% 31 = 50cent verloren (f50L)
+% 32 = 50cent gewonnen (f50G)
+% 41 = 75cent verloren (f75L)
+% 42 = 75cent gewonnen (f75G)
+% 51 = 100cent verloren (f100L)
+% 52 = 100cent gewonnen (f100G)
+
+
+if isempty(ExMaskChar); ExMaskChar=char(''); end
+if isempty(InMaskChar); InMaskChar=char(''); end
+if isempty(RunVec);  RunVec=[2]; end   %1 2
+if isempty(SessVec); SessVec=[1]; end  %1 2
+if isempty(SubVec);  SubVec=[1 3 5 9 13 19 21 25 29 47 51 53 55 57 59 65 4 6 12 14 18 26 28 42 44 46 52 54 56 60 64 66]; end  % 1 3 5 9 13 19 21 25 29 47 51 53 55 57 59 65 4 6 12 14 18 26 28 42 44 46 52 54 56 60 64 66
+
+if isempty(ParentDir); ParentDir='Z:\kroker\GameTdcsFrameBetween\MEG\GameTdcsFrameBetweenRiskAna'; end
+if isempty(BatchPath); BatchPath='Z:\kroker\GameTdcsFrameBetween\MEG\GameTdcsFrameBetweenRiskAna\00Batches'; end
+
+
+%ExMaskChar=char('*.mrk','*.bak','*.dsc','*.log','*.segments','BadChannels');
+
+
+InMaskChar=char('*AEM');
+InMaskChar=char('*at120','*at140','*at160','*at180','*at220','*at240','*at260','*at280');
+InMaskChar=char('*at122','*at142','*at162','*at182','*at222','*at242','*at262','*at282','*at123','*at143','*at163','*at183','*at223','*at243','*at263','*at283');
+%InMaskChar=char('*at120','*at140','*at160','*at180'); % CalcAvgMean4 Ano
+%InMaskChar=char('*at220','*at240','*at260','*at280');% CalcAvgMean4 Catho
+%InMaskChar=char('*.at110&111&112&113.100.MN5.m4','*.at210&211&212&213.100.MN5.m4'); %Corr Expected Value
+%InMaskChar=char('*app110','*app111','*app112','*app113','*app210','*app211','*app212','*app213');
+%InMaskChar=char('*at00*');
+%InMaskChar=char('*i110','*i111','*i112','*i113'); %,'*i210','*i211','*i212','*i213');
+%InMaskChar=char('*.pmg');
+%InMaskChar=char('*.cot');
+%InMaskChar=char('*ses.ctf');
+%InMaskChar=char('*.con');
+InMaskChar=char('*at120.100.MN5','*at220.100.MN5','*at140.100.MN5','*at240.100.MN5','*at160.100.MN5','*at260.100.MN5','*at180.100.MN5','*at280.100.MN5','*at122.100.MN5','*at222.100.MN5','*at142.100.MN5','*at242.100.MN5','*at162.100.MN5','*at262.100.MN5','*at182.100.MN5','*at282.100.MN5','*at123.100.MN5','*at223.100.MN5','*at143.100.MN5','*at243.100.MN5','*at163.100.MN5','*at263.100.MN5','*at183.100.MN5','*at283.100.MN5'); %Stats Thirds
+%InMaskChar=char('*at120.100.MN5','*at140.100.MN5','*at160.100.MN5','*at180.100.MN5','*at220.100.MN5','*at240.100.MN5','*at260.100.MN5','*at280.100.MN5')
+%InMaskChar=char('*at122.100.MN5','*at142.100.MN5','*at162.100.MN5','*at182.100.MN5','*at222.100.MN5','*at242.100.MN5','*at262.100.MN5','*at282.100.MN5','*at123.100.MN5','*at143.100.MN5','*at163.100.MN5','*at183.100.MN5','*at223.100.MN5','*at243.100.MN5','*at263.100.MN5','*at283.100.MN5');
+InMaskChar=char('*at122.100.MN5','*at222.100.MN5','*at142.100.MN5','*at242.100.MN5','*at162.100.MN5','*at262.100.MN5','*at182.100.MN5','*at282.100.MN5')
+InMaskChar=char('*at123.100.MN5','*at223.100.MN5','*at143.100.MN5','*at243.100.MN5','*at163.100.MN5','*at263.100.MN5','*at183.100.MN5','*at283.100.MN5')
+
+%BatchFileChar=['at-post-gainloss-anocat']
+%BatchFileChar=['AEM']
+%BatchFileChar=['Calc-MN5']
+%BatchFileChar=['App2at']
+%BatchFileChar=['Calc-MN5-ML']
+%BatchFileChar=['i-Files']
+%BatchFileChar=['Stats']
+%BatchFileChar=['pmg']
+%BatchFileChar=['cot']
+%BatchFileChar=['con']
+BatchFileChar=['ses.ctf']
+%BatchFileChar=['at111-112-121-122-211-212-221-222.100.MN5.rep']
+
+StudyStr='GTB';
+
+DL=[];
+RenameStatus=0
+
+for SessIndTmp=1:length(SessVec)
+    SessInd=SessVec(SessIndTmp);
+    SessIndStr=int2str(SessInd);
+     
+    for InMaskInd=1:size(InMaskChar,1)
+        InMask=deblank(InMaskChar(InMaskInd,:))
+                
+        for SubIndTmp=1:length(SubVec)
+            SubInd=SubVec(SubIndTmp);
+            SubIndStr=int2str(SubInd);
+            if SubInd<10; 
+                SubIndStr=['C0',SubIndStr]; 
+            else
+                 SubIndStr=['C',SubIndStr];
+            end
+            
+            for RunIndTmp=1:length(RunVec)
+                RunInd=RunVec(RunIndTmp);
+                RunIndStr=int2str(RunInd);
+                if RunInd>0
+                    Path=[ParentDir,filesep,StudyStr,'-',SubIndStr,filesep,StudyStr,'-',SubIndStr,'-',SessIndStr,filesep,StudyStr,'-',SubIndStr,'-',RunIndStr,'.ds',filesep]
+                else
+                    Path=[ParentDir,filesep,StudyStr,'-',SubIndStr,filesep,StudyStr,'-',SubIndStr,'-',SessIndStr,filesep]
+                end
+                
+                PathMask=[Path,InMask]
+                D=dir(PathMask)
+                
+                for k=length(D):-1:1
+                    FilePath=[Path,D(k).name];
+                    TakeFile=1;
+                    ExMaskInd=1;
+                    while TakeFile & ExMaskInd<=size(ExMaskChar,1)
+                        ExMask=deblank(ExMaskChar(ExMaskInd,:));
+                        if ~isempty(findstr(FilePath,ExMask))
+                            TakeFile=0;
+                        end
+                        ExMaskInd=ExMaskInd+1;
+                    end
+                    if TakeFile
+                        if RenameStatus
+                            RenFilePath=[Path,StudyStr,'-',D(k).name];
+                            copyfile(FilePath,RenFilePath,'writable');
+                            delete(FilePath);
+                            FilePath=RenFilePath;
+                            RenFilePath=[];
+                        end
+                        if isempty(DL)
+                            DL=char(FilePath);
+                        else
+                            DL=char(DL,FilePath);
+                        end
+                    end
+                end
+            end
+        end
+    end
+end
+if RenameStatus; return; end
+if isempty(DL);
+    fprintf(1,['Sorry, no files with mask "',InMaskChar,'" found ...']); return;
+end
+if ~isempty(BatchPath)
+    DefBatchFilePath=[BatchPath,filesep,'Batch.',BatchFileChar,'.rep']
+    SaveFileMat(DL,[],DefBatchFilePath);
+end
+return;