Home > eeg > egis > meg_code > parse_names.m

parse_names

PURPOSE ^

SYNOPSIS ^

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);

DESCRIPTION ^

pulls out the index numbers on a trial of data that would be the 
MEG data and EEG data respectively as meg_indices and eeg_indices
then creates meg_assign and eeg_assign which have the info to order 
the data correctly.  Similary there are analog and noise information 

e.g. to get the meg_data ordered correctly 

 trialdata(meg_channels) = trialdata(meg_indices);
 trialdata(reference_channels) = trialdata(reference_indices);
 etc.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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 %pulls out the index numbers on a trial of data that would be the
0004 %MEG data and EEG data respectively as meg_indices and eeg_indices
0005 %then creates meg_assign and eeg_assign which have the info to order
0006 %the data correctly.  Similary there are analog and noise information
0007 %
0008 %e.g. to get the meg_data ordered correctly
0009 %
0010 % trialdata(meg_channels) = trialdata(meg_indices);
0011 % trialdata(reference_channels) = trialdata(reference_indices);
0012 % etc.
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

Generated on Sat 25-May-2019 04:00:51 by m2html © 2003