|
@@ -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;
|