Home > utils > set_pres_col_const.m

set_pres_col_const

PURPOSE ^

Figures out which data columns in a Presentation logfile correspond to

SYNOPSIS ^

function PL = set_col_const(var_list)

DESCRIPTION ^

 Figures out which data columns in a Presentation logfile correspond to
 different variables 

 var_list is a cell string containing field names
 PL is a structure with constants (column ids) assigned for the following
 fields:

 SUB_ID -- subject ID
 STIM_ID -- stimulus ID
 DATE_TIME -- datestamp
 QUEST_ID -- question ID
 QUEST_TXT -- question text
 SUBQUEST_TXT -- subquestion text (heading)
 SUBQUEST_ID -- subquestion ID
 QUEST_ITER -- question iteration
 RESP_ENUM -- response value
 RESP_TXT -- response text
 STIM_TYPE -- stimulus type
 PAIR_IDX -- pair index

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function PL = set_col_const(var_list)
0002 % Figures out which data columns in a Presentation logfile correspond to
0003 % different variables
0004 %
0005 % var_list is a cell string containing field names
0006 % PL is a structure with constants (column ids) assigned for the following
0007 % fields:
0008 %
0009 % SUB_ID -- subject ID
0010 % STIM_ID -- stimulus ID
0011 % DATE_TIME -- datestamp
0012 % QUEST_ID -- question ID
0013 % QUEST_TXT -- question text
0014 % SUBQUEST_TXT -- subquestion text (heading)
0015 % SUBQUEST_ID -- subquestion ID
0016 % QUEST_ITER -- question iteration
0017 % RESP_ENUM -- response value
0018 % RESP_TXT -- response text
0019 % STIM_TYPE -- stimulus type
0020 % PAIR_IDX -- pair index
0021 %
0022 
0023 % 04/11/05  Petr Janata - adapted from the set_col_const.m script I wrote for
0024 %                         database stuff
0025 % 05/03/11 - FB - added STIM_TYPE, PAIR_IDX (new output vars)
0026 
0027 % The mappings variable has structure field names in the 1st column and
0028 % variable names in the 2nd column.  Abandon the mappings approach for the time being.
0029 mappings = { ...
0030       'SUB_ID', 'Subject'; ...
0031       'TRIAL_NUM', 'Trial'; ...
0032       'EVENT_TYPE', 'Event Type'; ...
0033       };
0034 
0035 
0036 PL = struct('SUB_ID',[], ...
0037     'TRIAL_NUM',[], ...
0038     'EVENT_TYPE',[], ...
0039     'EVENT_CODE',[], ...
0040     'EVENT_ABSTIME',[], ...
0041     'EVENT_TTIME',[], ...
0042     'TTIME_UNC',[], ...
0043     'DUR_UNC',[], ...
0044     'REQ_TIME',[], ...
0045     'REQ_DUR',[], ...
0046     'RUN_REL_TIME',[], ...
0047     'RESP_CODE',[], ...
0048     'RESP_TIME',[], ...
0049     'RUN',[], ...
0050     'STIM_ID',[], ...
0051     'STIM_TYPE',[], ...
0052     'PAIR_IDX',[] ...
0053     );
0054 
0055 nvars = length(var_list);
0056 for ivar = 1:nvars
0057   switch var_list{ivar}
0058     case {'Subject','SUB_ID'}
0059       PL.SUB_ID = ivar;
0060       
0061     case {'Trial','TRIAL_NUM'}
0062       PL.TRIAL_NUM = ivar;
0063   
0064     case {'Event Type','EVENT_TYPE'}
0065       PL.EVENT_TYPE = ivar;
0066       
0067     case {'Code','EVENT_CODE'}
0068       PL.EVENT_CODE = ivar;
0069     
0070     case {'Time','EVENT_ABSTIME'}
0071       PL.EVENT_ABSTIME = ivar;  % absolute time in experiment - in msec (10^-3)
0072       
0073     case {'TTime','EVENT_TTIME'}
0074       PL.EVENT_TTIME = ivar;  % time in trial - 10^-4
0075 
0076     case {'Stim Type','STIM_TYPE'}
0077       PL.STIM_TYPE = ivar;
0078       
0079     case {'Pair Index','PAIR_IDX'}
0080       PL.PAIR_IDX = ivar;
0081           
0082     case 'Uncertainty'
0083       switch var_list{ivar-1}
0084     case {'TTime','TTIME_UNC'}
0085       PL.TTIME_UNC = ivar;
0086     case {'Duration','DUR_UNC'}
0087       PL.DUR_UNC = ivar;
0088     otherwise
0089       fprintf('set_col_const: Uncertain about uncertainty column\n');
0090       end
0091     
0092     case {'ReqTime','REQ_TIME'}
0093       PL.REQ_TIME = ivar; % 10^-4
0094     
0095     case {'ReqDur','REQ_DUR'}
0096       PL.REQ_DUR = ivar; % 10^-4
0097       
0098       case {'ResponseCode','RESP_CODE'}
0099           PL.RESP_CODE = ivar;
0100           
0101       case {'ResponseTime','RESP_TIME'}
0102           PL.RESP_TIME = ivar;
0103           
0104       case {'Run Relative Time','RUN_REL_TIME'}
0105           PL.RUN_REL_TIME = ivar;
0106           
0107       case {'Run','RUN'}
0108           PL.RUN = ivar;
0109 
0110       case {'stimulus id','stimulus_id','stim_id','STIM_ID'}
0111           PL.STIM_ID = ivar;
0112           
0113   end % switch
0114 end % for ivar
0115 
0116 return

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003