Home > data-access > get_trial_times.m

get_trial_times

PURPOSE ^

GET_TRIAL_TIMES Returns trial information in seconds

SYNOPSIS ^

function [ times ] = get_trial_times( subject_id, trial_values)

DESCRIPTION ^

GET_TRIAL_TIMES Returns trial information in seconds
   USAGE:
   get_trial_times(SUBJECT_ID, TRIAL_VALUES)
       Figures out the time stamps for the given subject, returning them
       in an Nx2 array, with each row containing the start and stop times
       for that trial.
       Sometimes there were multiple trials for one subject, by specifying
       the value of TRIAL_VALUES, user can only output the selected trials
       for the subject, instead of all trials.

   For now, this function looks up the subject's trial info in frames, and
   then uses the frame_num2time function to convert each time stamp.  This
   means that it relies on the timing information to be accurate.

   Some trials are listed in the _info.txt file as starting and ending at
   -1 frames, indicating that they are invalid.  These trials are filtered
   out by get_timing(), and are NOT returned by this function (changed Jan
   13 2011). See also: LIST_MISSING_TRIALS

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ times ] = get_trial_times( subject_id, trial_values)
0002 %GET_TRIAL_TIMES Returns trial information in seconds
0003 %   USAGE:
0004 %   get_trial_times(SUBJECT_ID, TRIAL_VALUES)
0005 %       Figures out the time stamps for the given subject, returning them
0006 %       in an Nx2 array, with each row containing the start and stop times
0007 %       for that trial.
0008 %       Sometimes there were multiple trials for one subject, by specifying
0009 %       the value of TRIAL_VALUES, user can only output the selected trials
0010 %       for the subject, instead of all trials.
0011 %
0012 %   For now, this function looks up the subject's trial info in frames, and
0013 %   then uses the frame_num2time function to convert each time stamp.  This
0014 %   means that it relies on the timing information to be accurate.
0015 %
0016 %   Some trials are listed in the _info.txt file as starting and ending at
0017 %   -1 frames, indicating that they are invalid.  These trials are filtered
0018 %   out by get_timing(), and are NOT returned by this function (changed Jan
0019 %   13 2011). See also: LIST_MISSING_TRIALS
0020 
0021 times = arrayfun(@(fnum) frame_num2time(fnum, subject_id), ...
0022     get_trials(subject_id));
0023 
0024 if nargin > 1
0025     times = times(trial_values, :);
0026 end
0027 
0028 end

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005