Home > data-import > make_inhand_number_of_objects.m

make_inhand_number_of_objects

PURPOSE ^

SYNOPSIS ^

function make_inhand_number_of_objects(IDs, obj_list)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function make_inhand_number_of_objects(IDs, obj_list)
0002 
0003 if numel(num2str(IDs(1))) > 2
0004     subs = IDs;
0005 else
0006     subs = list_subjects(IDs);
0007 end
0008 
0009 if ~exist('obj_list', 'var') || isempty(obj_list)
0010     obj_list = [1 2 3];
0011 end
0012 
0013 agents = {'child','parent'};
0014 
0015 sub_list = subs;
0016 
0017 for s = 1 : numel(sub_list)
0018     sub = sub_list(s);
0019     for a = 1 : numel(agents)
0020         agent = agents{a};
0021         
0022         try 
0023            data = []; temp =[]; data_per_obj = [];
0024            for o = 1 : numel(obj_list)
0025                variable_name = sprintf('cstream_inhand_obj%d_%s',o,agent);
0026                temp = get_variable(sub, variable_name);
0027                index = find(temp(:,2) > 0);
0028                temp(index,2) = 1; 
0029                data_per_obj(:,o) = temp(:,2);
0030            end;
0031            data(:,1) = temp(:,1);
0032            data(:,2) = sum(data_per_obj,2);
0033            
0034 %            trial_time = get_trial_times(sub);
0035 %            new_data = cont_extract_ranges(data,[trial_time(1,1) ...
0036 %                                trial_time(end,2)]);
0037            variable_name = sprintf('cstream_inhand_num-of-objects_%s',agent);
0038            %            record_variable(sub, variable_name, new_data{1});
0039            record_variable(sub, variable_name, data);
0040         catch ex
0041             disp(ex.message);
0042             fprintf('skipping subject %d, %s\n', sub, agent);
0043             continue;
0044         end;
0045     end;
0046 end;

Generated on Tue 23-May-2017 20:00:55 by m2html © 2005