Home > matlabmk > flag_art.m

flag_art

PURPOSE ^

flag_art() - Create temporary logfile with artifacts flagged

SYNOPSIS ^

function logfile=flag_art(logfile,arffile,crwfile,blffile,presam,cprecis)

DESCRIPTION ^

 flag_art() - Create temporary logfile with artifacts flagged
              according to an arf file
 Usage:
  >> logfile=flag_art(logfile,arffile,crwfile,blffile,presam)


 Required Global Variables:
   VERBLEVEL = matlabMK level of verbosity (i.e., tells functions
               how much to report about what they're doing during
               runtime)


 Inputs:
   logfile = name of the Kutaslab .log file (a string)
   arffile = name of the Kutaslab .arf file (a string)
   crwfile = name of the Kutaslab .crw file (a string)
   blffile = name of the Kutaslab .blf file (a string)
   presam  = prestimulus baseline length (in msec)
   cprecis = channel precision (the number of time points per epoch
              considered by the arf file is 256*cprecis)


 Outputs:
   logfile = the string "temp.log," the name of the temporary
             logfile created by the function


 Author:
 David Groppe
 Kutaslab, 8/2009

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function logfile=flag_art(logfile,arffile,crwfile,blffile,presam,cprecis)
0002 % flag_art() - Create temporary logfile with artifacts flagged
0003 %              according to an arf file
0004 % Usage:
0005 %  >> logfile=flag_art(logfile,arffile,crwfile,blffile,presam)
0006 %
0007 %
0008 % Required Global Variables:
0009 %   VERBLEVEL = matlabMK level of verbosity (i.e., tells functions
0010 %               how much to report about what they're doing during
0011 %               runtime)
0012 %
0013 %
0014 % Inputs:
0015 %   logfile = name of the Kutaslab .log file (a string)
0016 %   arffile = name of the Kutaslab .arf file (a string)
0017 %   crwfile = name of the Kutaslab .crw file (a string)
0018 %   blffile = name of the Kutaslab .blf file (a string)
0019 %   presam  = prestimulus baseline length (in msec)
0020 %   cprecis = channel precision (the number of time points per epoch
0021 %              considered by the arf file is 256*cprecis)
0022 %
0023 %
0024 % Outputs:
0025 %   logfile = the string "temp.log," the name of the temporary
0026 %             logfile created by the function
0027 %
0028 %
0029 % Author:
0030 % David Groppe
0031 % Kutaslab, 8/2009
0032 
0033 global VERBLEVEL
0034  
0035 %make temporary copy of log file to which we can add artifact flags with
0036 %impunity
0037 VerbReport(sprintf(['\nCreating temporary log file, temp.log, in order to add' ...
0038             ' artifact flags to logfile.']),1,VERBLEVEL);  
0039 %remove temp.log in case it already exists
0040 arf_cmnd='rm -f temp.log';
0041 unix(arf_cmnd);
0042 
0043 %copy logfile to temp.log
0044 arf_cmnd=sprintf('cp %s temp.log',logfile);
0045 [s, w]=unix(arf_cmnd);
0046 if s~=0,
0047   disp('Could not create temporary log file: temp.log');
0048   error('According to cp: %s',w); 
0049 end
0050 logfile='temp.log';
0051 
0052 %remove temp.avg in case it already exists
0053 arf_cmnd='rm -f temp.avg';
0054 [s, w]=unix(arf_cmnd);
0055 if s~=0,
0056   disp('Could not remove temporary avg file: temp.avg.');
0057   error('According to rm: %s',w); 
0058 end
0059 VerbReport(sprintf('Artifact flags based on: %s',arffile),1,VERBLEVEL);
0060 VerbReport(['Creating temporary avg file in order to add' ...
0061         ' artifact flags to temp.log:'],1,VERBLEVEL);
0062 arf_cmnd=['echo "' crwfile ' ' logfile ' ' blffile ' \n none "' ...
0063       ' | avg ' int2str(presam) ' temp.avg' ...
0064       ' -a ' arffile ' -x -c ' int2str(cprecis)];
0065 VerbReport(arf_cmnd,2,VERBLEVEL);
0066 %remove temp.avg if it exists
0067 unix('rm -f temp.avg');
0068 [s, w]=unix(arf_cmnd);
0069 if s~=0,
0070   disp(['Could not create temporary avg file in order to add' ...
0071     ' artifact flags to logfile.']);
0072   error('According to avg: %s',w); 
0073 end
0074 VerbReport('Removing temporary avg file: temp.avg',1,VERBLEVEL);
0075 arf_cmnd='rm -f temp.avg';
0076 [s, w]=unix(arf_cmnd);
0077 if s~=0,
0078   disp('Could not remove temporary avg file: temp.avg.');
0079   error('According to rm: %s',w); 
0080 end
0081

Generated on Tue 10-May-2016 16:37:45 by m2html © 2005