Home > data-import > make_naming_local_id.m

make_naming_local_id

PURPOSE ^

take cevent_naming and create a new one cevent_naming_local_id

SYNOPSIS ^

function make_naming_local_id(IDs, fix)

DESCRIPTION ^

 take cevent_naming and create a new one cevent_naming_local_id
 by changing the 3rd column from word IDs to local IDs (1/2/3)
 and aslo create a cstream variable

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function make_naming_local_id(IDs, fix)
0002 % take cevent_naming and create a new one cevent_naming_local_id
0003 % by changing the 3rd column from word IDs to local IDs (1/2/3)
0004 % and aslo create a cstream variable
0005 
0006 subs = cIDs(IDs);
0007 
0008 if ~exist('fix', 'var') || isempty(fix)
0009     fix = 0;
0010 end
0011 
0012 for s = 1:numel(subs)
0013     exp_id = sub2exp(subs(s));
0014     %table is under multiwork/stimulus_table.txt
0015     switch exp_id
0016         case {14}
0017             table = [701 1; 550 2; 700 3; 555 1; 539 2; 554 3];
0018         case {19}
0019             table = [555 1; 554 3; 539 2; 550 2; 551 1; 549 3];
0020         case {29, 32, 34, 41, 43, 44, 49}
0021             table = [555 1; 539 2; 554 3;  701 1; 550 2; 700 3];
0022             switch subs(s)
0023                 case {4108 4109}
0024                     table = [368 1; 359 2; 349 3; 2783 1; 372 2; 2782 3];
0025             end
0026         case {35}
0027             table = [1294 1; 716 2; 271 3; 945 1; 837 2; 1362 3];
0028         case {70}
0029             table = [1294 1; 716 2; 1078 3; 945 1; 2713 2; 1362 3];
0030         case {71}
0031             table = [549 1; 550 2; 554 3; 2828 1; 539 2; 2783 3];
0032         case {72}
0033             table = [368 1; 2846 2; 701 3; 359 1; 349 2; 372 3];
0034         case {73}
0035             table = [2969 1; 2967 2; 2968 3; 2970 1; 2972 2; 2971 3];
0036         case {74}
0037             table = [3117 1; 3118 2; 3116 3; 3113 1; 3111 2; 3114 3];
0038         case {75}
0039             table = [3204 1; 3206 2; 3205 3; 3208 1; 3210 2; 3207 3];
0040             
0041         otherwise
0042             error('No table for this exp ID');
0043     end;
0044     
0045     try
0046         naming = get_variable(subs(s), 'cevent_speech_naming');
0047         %check if naming includes the correct id numbers
0048         log = ~ismember(naming(:,3), table(:,1));
0049         if sum(log) > 0
0050             if fix
0051                 record_variable_into_specified_directory(subs(s), 'extra_p', 'cevent_speech_naming', naming);
0052                 naming(log,:) = [];
0053                 record_variable(subs(s), 'cevent_speech_naming', naming);
0054             else
0055                 error('cevent_speech_naming includes name ids not included in the table')
0056             end
0057         end
0058     catch ME
0059         disp(ME.message);
0060         fprintf (1,'skip subject :%d\n', subs(s));
0061         continue;
0062     end;
0063     naming_local_id = naming;
0064     for j = 1 : size(naming,1)
0065         index = find(naming(j,3) == table(:,1));
0066         naming_local_id(j,3) = table(index,2);
0067     end;
0068     record_variable(subs(s),'cevent_speech_naming_local-id', ...
0069         naming_local_id);
0070     
0071 end
0072 end
0073

Generated on Tue 23-May-2017 03:00:58 by m2html © 2005