Home > data-import > make_joint_inhand_both.m

make_joint_inhand_both

PURPOSE ^

SYNOPSIS ^

function make_joint_inhand_both(IDs)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function make_joint_inhand_both(IDs)
0002 subs = cIDs(IDs);
0003 
0004 for s = 1:numel(subs)
0005     fprintf('%d\n', subs(s));
0006     try
0007     num_obj = get_num_obj(subs(s));
0008     lc = get_variable(subs(s), 'cstream_inhand_left-hand_obj-all_child');
0009     rc = get_variable(subs(s), 'cstream_inhand_right-hand_obj-all_child');
0010     lp = get_variable(subs(s), 'cstream_inhand_left-hand_obj-all_parent');
0011     rp = get_variable(subs(s), 'cstream_inhand_right-hand_obj-all_parent');
0012 
0013     all = [lc(:,2) rc(:,2) lp(:,2) rp(:,2)];
0014     final = cell(num_obj, 1);
0015     for o = 1:num_obj
0016         log = all == o;
0017         tmp = (log(:,1) | log(:,2)) & (log(:,3) | log(:,4));
0018         tmp_f = zeros(size(tmp));
0019         tmp_f(tmp) = o;
0020         final{o,1} = tmp_f;
0021     end
0022     
0023     final = horzcat(final{:});
0024     if max(sum(final>0, 2)) > 1
0025         warning('%d has overlapping events', subs(s));
0026         cevents = [];
0027         for o = 1:size(final,2)
0028             tmp = cstream2cevent([lc(:,1) final(:,o)]);
0029             cevents = [cevents;tmp];
0030         end
0031         cevents = sortrows(cevents, [1 2 3]);
0032         final = cevent2cstream_v2(cevents, [], [], lc(:,1));
0033     else
0034         final = [lc(:,1) sum(final,2)];
0035     end
0036     record_variable(subs(s), 'cstream_inhand_joint-holding_both', final);
0037     cev = cstream2cevent(final);
0038     record_variable(subs(s), 'cevent_inhand_joint-holding_both', cev);
0039     catch ME
0040         fprintf('%d, %s\n', subs(s), ME.message);
0041     end
0042 end
0043 
0044 
0045 
0046 end

Generated on Tue 23-May-2017 02:00:59 by m2html © 2005