0001 function [meg_indices, meg_channels, bad_sensors, eeg_indices, eeg_channels,analog_indices, analog_channels, reference_indices, reference_channels] = parse_names(Names, NMeg, NEeg, NBad_Sensors,NAnalog,NReference);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 trigger_index = find(Names(:,1) == 'T')';
0015 response_index = find(Names(:,1) == 'R')';
0016 utility_index = find(Names(:,1) == 'U')';
0017 meg_indices = find(Names(:,1) == 'A')';
0018 reference_indices = find(Names(:,1) == 'M'|Names(:,1) == 'G')';
0019 bad_sensor_indices = find(Names(:,1) =='E' & Names(:,2) == 'A')';
0020 eeg_indices = find(Names(:,1) == 'E' & Names(:,2) ~= 'A')';
0021 analog_indices = find(Names(:,1) == 'X')';
0022
0023 for i = 1:NMeg
0024 meg_channels(i) = str2num(Names(meg_indices(i),2:5));
0025 end;
0026 total_NMeg = 148;
0027 reference_channels(1:NReference) = [total_NMeg+1:total_NMeg+NReference];
0028
0029 if NEeg > 0
0030 for i = 1:NEeg
0031 eeg_channels(i) = str2num(Names(eeg_indices(i),2:5))+103+NReference;
0032 end;
0033 else
0034 eeg_channels = [];
0035 end;
0036 if NAnalog > 0
0037 for i = 1:NAnalog
0038 analog_channels(i) = str2num(Names(analog_indices(i),2:5))+total_NMeg+NEeg+NReference;
0039 end;
0040 else
0041 analog_channels = [];
0042 end;
0043
0044 if NBad_Sensors > 0
0045 for i = 1:NBad_Sensors
0046 bad_sensors(i) = str2num(Names(bad_sensor_indices(i),3:6));
0047 end;
0048 else
0049 bad_sensors = [];
0050 end
0051
0052 if NMeg + NBad_Sensors < 148
0053 mask = ones(1,148);
0054 mask(meg_channels) = zeros(1,size(meg_channels,2));
0055 mask(bad_sensors) = zeros(1,size(bad_sensors,2));
0056 bad_sensors = [bad_sensors find(mask)];
0057 end;
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086