Home > data-import > make_inmouth_vars.m

make_inmouth_vars

PURPOSE ^

SYNOPSIS ^

function make_inmouth_vars(IDs)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function make_inmouth_vars(IDs)
0002 
0003 subs = cIDs(IDs);
0004 
0005 for s = 1:numel(subs)
0006     data = [];
0007     for o = 1:3
0008         varname = sprintf('cstream_inmouth_obj%d_child', o);
0009         if has_variable(subs(s), varname)
0010             tmp = get_variable(subs(s), varname);
0011             if isempty(data)
0012                 data = tmp;
0013             else
0014                 data = [data tmp(:,2)];
0015             end
0016         end
0017     end
0018     if ~isempty(data)
0019         cat = sum(data(:,2:end), 2);
0020         if max(cat) > 3
0021             error('max greater than 3');
0022         end
0023         final = [data(:,1) cat];
0024         record_variable(subs(s), 'cstream_inmouth_obj-all_child', final);
0025         cev = cstream2cevent(final);
0026         record_variable(subs(s), 'cevent_inmouth_obj-all_child', cev);
0027     end
0028     
0029     data2 = [];
0030     for i = 1:3
0031         varnames = {'cstream_inmouth_parent_child'; 'cstream_inmouth_self_child'; 'cstream_inmouth_other_child'};
0032         if has_variable(subs(s), varnames{i})
0033             tmp2 = get_variable(subs(s), varnames{i});
0034             if isempty(data2)
0035                 data2 = tmp2;
0036             else
0037                 data2 = [data2 tmp2(:,2)];
0038             end
0039         end
0040     end
0041         
0042     if ~isempty(data2)
0043         cat = sum(data2(:,2:end), 2);
0044         if max(cat) > 6
0045             error('max greater than 6');
0046         end
0047         final = [data2(:,1) cat];
0048         record_variable(subs(s), 'cstream_inmouth_other-all_child', final);
0049         cev = cstream2cevent(final);
0050         record_variable(subs(s), 'cevent_inmouth_other-all_child', cev);
0051     end
0052     
0053     data3 = [];
0054     for v = 1:6
0055         varnames2 = {'cstream_inmouth_obj1_child'; 'cstream_inmouth_obj2_child'; 'cstream_inmouth_obj3_child'; 'cstream_inmouth_self_child'; 'cstream_inmouth_parent_child'; 'cstream_inmouth_other_child'};
0056         if has_variable(subs(s), varnames2{v})
0057             tmp3 = get_variable(subs(s), varnames2{v});
0058             if isempty(data3)
0059                 data3 = tmp3;
0060             else
0061                 data3 = [data3 tmp3(:,2)];
0062             end
0063         end
0064     end
0065         
0066     if ~isempty(data3)
0067         cat = sum(data3(:,2:end), 2);
0068         if max(cat) > 6
0069             error('max greater than 6');
0070         end
0071         final = [data3(:,1) cat];
0072         record_variable(subs(s), 'cstream_inmouth_all_child', final);
0073         cev = cstream2cevent(final);
0074         record_variable(subs(s), 'cevent_inmouth_all_child', cev);
0075     end
0076         
0077 end

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