Home > vbmeg > functions > device > eeg > vb_eegfile_replace_label.m

vb_eegfile_replace_label

PURPOSE ^

replace channel labels of eegfile

SYNOPSIS ^

function [result] = vb_eegfile_replace_label(src_file, dst_file, rpl_type)

DESCRIPTION ^

 replace channel labels of eegfile
 [usage]
   [result] = vb_eegfile_replace_label(src_file, dst_file, rpl_type)
 [input]
   src_file : <required> EEG-MAT file that will be converted
   dst_file : <required> EEG-MAT file that will be newly made
   rpl_type : <optional> replace type
            :   0 ) EEG from Fp1 series to A1 series (Biosemi 64 ch default)
            :  [1]) EEG from A1 series to Fp1 series (as the src is)
            :   2 ) overwrite the Fp1 series label into existing labels
 [output]
     result : ==0) success
            : ~=0) error occured
 [note]
   See also:
   vb_posfile_replace_label

 [history]
   2012-11-14 (Sako) initial version

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [result] = vb_eegfile_replace_label(src_file, dst_file, rpl_type)
0002 % replace channel labels of eegfile
0003 % [usage]
0004 %   [result] = vb_eegfile_replace_label(src_file, dst_file, rpl_type)
0005 % [input]
0006 %   src_file : <required> EEG-MAT file that will be converted
0007 %   dst_file : <required> EEG-MAT file that will be newly made
0008 %   rpl_type : <optional> replace type
0009 %            :   0 ) EEG from Fp1 series to A1 series (Biosemi 64 ch default)
0010 %            :  [1]) EEG from A1 series to Fp1 series (as the src is)
0011 %            :   2 ) overwrite the Fp1 series label into existing labels
0012 % [output]
0013 %     result : ==0) success
0014 %            : ~=0) error occured
0015 % [note]
0016 %   See also:
0017 %   vb_posfile_replace_label
0018 %
0019 % [history]
0020 %   2012-11-14 (Sako) initial version
0021 %
0022 % Copyright (C) 2011, ATR All Rights Reserved.
0023 % License : New BSD License(see VBMEG_LICENSE.txt)
0024 
0025 func_ = mfilename;
0026 result = 0; % success
0027 
0028 % --- CHECK ARGUMENTS --- %
0029 if ~exist('src_file', 'var'), src_file = ''; end
0030 if ~exist('dst_file', 'var'), dst_file = ''; end
0031 if ~exist('rpl_type', 'var'), rpl_type = []; end
0032 
0033 [src_file, dst_file, rpl_type] = ...
0034   inner_check_arguments(src_file, dst_file, rpl_type);
0035 
0036 % --- MAIN PROCEDURE --------------------------------------------------------- %
0037 %
0038 eeg = load(src_file);
0039 if ~isfield(eeg, 'EEGinfo') || ~isfield(eeg.EEGinfo, 'ChannelName')
0040   fprintf('(%s) cannot find EEGinfo.ChannelName\n', func_);
0041   result = 1; % failure
0042   return;
0043 end
0044 
0045 switch rpl_type
0046   case 0
0047     new_labels = inner_fp1_to_a1(eeg.EEGinfo.ChannelName);
0048 
0049   case 1
0050     file_fld = [];
0051     if isfield(eeg.EEGinfo, 'File')
0052       if isfield(eeg.EEGinfo.File, 'DataDir') ...
0053           && ~isempty(eeg.EEGinfo.File.DataDir)
0054         file_fld = eeg.EEGinfo.File;
0055         
0056         f_path = fileparts(src_file);
0057         if isempty(f_path)
0058           f_path = './';
0059         end
0060         file_fld.eegfile_dir = f_path;
0061       end
0062     end
0063     new_labels = inner_a1_to_fp1(eeg.EEGinfo.ChannelName, file_fld);
0064 
0065   case 2
0066     new_labels = inner_set_fp1(eeg.EEGinfo.ChannelName);
0067 
0068   otherwise
0069     fprintf('(%s) unknown replace type : %d\n', func_, rpl_type);
0070     result = 1;
0071     return;
0072 end
0073 
0074 % overwrite labels
0075 eeg.EEGinfo.ChannelName = new_labels;
0076 vb_save_struct(dst_file, eeg);
0077 return;
0078 end
0079 %
0080 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0081 
0082 % --- INNER FUNCTIONS -------------------------------------------------------- %
0083 %
0084 % --- inner_check_arguments()
0085 %
0086 function [src_file, dst_file, rpl_type] = ...
0087   inner_check_arguments(src_file, dst_file, rpl_type)
0088 func_ = mfilename;
0089 
0090 if isempty(src_file)
0091   error('(%s) src_file is a required parameter', func_);
0092 end
0093 
0094 if exist(src_file, 'file') ~= 2
0095   error('(%s) cannot find src_file : %s\n', func_, src_file);
0096 end
0097 
0098 if isempty(dst_file)
0099   error('(%s) dst_file is a required parameter', func_);
0100 end
0101 
0102 if isempty(rpl_type)
0103   rpl_type = 1;
0104 end
0105 return;
0106 end
0107 %
0108 % --- end of inner_check_arguments()
0109 
0110 
0111 % --- inner_fp1_to_a1()
0112 %
0113 function new_labels = inner_fp1_to_a1(old_labels)
0114 
0115 n_old = length(old_labels);
0116 n_label = n_old;
0117 new_labels = cell(n_label,1);
0118 
0119 % --- copy old to new
0120 for i_label = 1:n_label
0121   new_labels{i_label} = old_labels{i_label};
0122 end
0123 
0124 i_new = 1;
0125 
0126 for i_old = 1:n_old
0127   if strcmp(old_labels{i_old}, 'Fp1'), new_labels{i_new} = 'A1';
0128   elseif strcmp(old_labels{i_old}, 'Fpz'), new_labels{i_new} = 'B1';
0129   elseif strcmp(old_labels{i_old}, 'Fp2'), new_labels{i_new} = 'B2';
0130 
0131   elseif strcmp(old_labels{i_old}, 'AF7'), new_labels{i_new} = 'A2';
0132   elseif strcmp(old_labels{i_old}, 'AF3'), new_labels{i_new} = 'A3';
0133   elseif strcmp(old_labels{i_old}, 'AFz'), new_labels{i_new} = 'B5';
0134   elseif strcmp(old_labels{i_old}, 'AF4'), new_labels{i_new} = 'B4';
0135   elseif strcmp(old_labels{i_old}, 'AF8'), new_labels{i_new} = 'B3';
0136   
0137   elseif strcmp(old_labels{i_old}, 'F7' ), new_labels{i_new} = 'A7';
0138   elseif strcmp(old_labels{i_old}, 'F5' ), new_labels{i_new} = 'A6';
0139   elseif strcmp(old_labels{i_old}, 'F3' ), new_labels{i_new} = 'A5';
0140   elseif strcmp(old_labels{i_old}, 'F1' ), new_labels{i_new} = 'A4';
0141   elseif strcmp(old_labels{i_old}, 'Fz' ), new_labels{i_new} = 'B6';
0142   elseif strcmp(old_labels{i_old}, 'F2' ), new_labels{i_new} = 'B7';
0143   elseif strcmp(old_labels{i_old}, 'F4' ), new_labels{i_new} = 'B8';
0144   elseif strcmp(old_labels{i_old}, 'F6' ), new_labels{i_new} = 'B9';
0145   elseif strcmp(old_labels{i_old}, 'F8' ), new_labels{i_new} = 'B10';
0146   
0147   elseif strcmp(old_labels{i_old}, 'FT7'), new_labels{i_new} = 'A8';
0148   elseif strcmp(old_labels{i_old}, 'FC5'), new_labels{i_new} = 'A9';
0149   elseif strcmp(old_labels{i_old}, 'FC3'), new_labels{i_new} = 'A10';
0150   elseif strcmp(old_labels{i_old}, 'FC1'), new_labels{i_new} = 'A11';
0151   elseif strcmp(old_labels{i_old}, 'FCz'), new_labels{i_new} = 'B15';
0152   elseif strcmp(old_labels{i_old}, 'FC2'), new_labels{i_new} = 'B14';
0153   elseif strcmp(old_labels{i_old}, 'FC4'), new_labels{i_new} = 'B13';
0154   elseif strcmp(old_labels{i_old}, 'FC6'), new_labels{i_new} = 'B12';
0155   elseif strcmp(old_labels{i_old}, 'FT8'), new_labels{i_new} = 'B11';
0156   
0157   elseif strcmp(old_labels{i_old}, 'T7' ), new_labels{i_new} = 'A15';
0158   elseif strcmp(old_labels{i_old}, 'C5' ), new_labels{i_new} = 'A14';
0159   elseif strcmp(old_labels{i_old}, 'C3' ), new_labels{i_new} = 'A13';
0160   elseif strcmp(old_labels{i_old}, 'C1' ), new_labels{i_new} = 'A12';
0161   elseif strcmp(old_labels{i_old}, 'Cz' ), new_labels{i_new} = 'B16';
0162   elseif strcmp(old_labels{i_old}, 'C2' ), new_labels{i_new} = 'B17';
0163   elseif strcmp(old_labels{i_old}, 'C4' ), new_labels{i_new} = 'B18';
0164   elseif strcmp(old_labels{i_old}, 'C6' ), new_labels{i_new} = 'B19';
0165   elseif strcmp(old_labels{i_old}, 'T8' ), new_labels{i_new} = 'B20';
0166   
0167   elseif strcmp(old_labels{i_old}, 'TP7'), new_labels{i_new} = 'A16';
0168   elseif strcmp(old_labels{i_old}, 'CP5'), new_labels{i_new} = 'A17';
0169   elseif strcmp(old_labels{i_old}, 'CP3'), new_labels{i_new} = 'A18';
0170   elseif strcmp(old_labels{i_old}, 'CP1'), new_labels{i_new} = 'A19';
0171   elseif strcmp(old_labels{i_old}, 'CPz'), new_labels{i_new} = 'A32';
0172   elseif strcmp(old_labels{i_old}, 'CP2'), new_labels{i_new} = 'B24';
0173   elseif strcmp(old_labels{i_old}, 'CP4'), new_labels{i_new} = 'B23';
0174   elseif strcmp(old_labels{i_old}, 'CP6'), new_labels{i_new} = 'B22';
0175   elseif strcmp(old_labels{i_old}, 'TP8'), new_labels{i_new} = 'B21';
0176   
0177   elseif strcmp(old_labels{i_old}, 'P9' ), new_labels{i_new} = 'A24';
0178   elseif strcmp(old_labels{i_old}, 'P7' ), new_labels{i_new} = 'A23';
0179   elseif strcmp(old_labels{i_old}, 'P5' ), new_labels{i_new} = 'A22';
0180   elseif strcmp(old_labels{i_old}, 'P3' ), new_labels{i_new} = 'A21';
0181   elseif strcmp(old_labels{i_old}, 'P1' ), new_labels{i_new} = 'A20';
0182   elseif strcmp(old_labels{i_old}, 'Pz' ), new_labels{i_new} = 'A31';
0183   elseif strcmp(old_labels{i_old}, 'P2' ), new_labels{i_new} = 'B25';
0184   elseif strcmp(old_labels{i_old}, 'P4' ), new_labels{i_new} = 'B26';
0185   elseif strcmp(old_labels{i_old}, 'P6' ), new_labels{i_new} = 'B27';
0186   elseif strcmp(old_labels{i_old}, 'P8' ), new_labels{i_new} = 'B28';
0187   elseif strcmp(old_labels{i_old}, 'P10'), new_labels{i_new} = 'B29';
0188   
0189   elseif strcmp(old_labels{i_old}, 'PO7'), new_labels{i_new} = 'A25';
0190   elseif strcmp(old_labels{i_old}, 'PO3'), new_labels{i_new} = 'A26';
0191   elseif strcmp(old_labels{i_old}, 'POz'), new_labels{i_new} = 'A30';
0192   elseif strcmp(old_labels{i_old}, 'PO4'), new_labels{i_new} = 'B31';
0193   elseif strcmp(old_labels{i_old}, 'PO8'), new_labels{i_new} = 'B30';
0194 
0195   elseif strcmp(old_labels{i_old}, 'O1' ), new_labels{i_new} = 'A27';
0196   elseif strcmp(old_labels{i_old}, 'Oz' ), new_labels{i_new} = 'A29';
0197   elseif strcmp(old_labels{i_old}, 'O2' ), new_labels{i_new} = 'B32';
0198 
0199   elseif strcmp(old_labels{i_old}, 'Iz' ), new_labels{i_new} = 'A28';
0200   end
0201   
0202   i_new = i_new + 1;
0203 end
0204 return;
0205 end
0206 %
0207 % --- end of inner_fp1_to_a1()
0208 
0209 
0210 % --- inner_a1_to_fp1()
0211 %
0212 function new_labels = inner_a1_to_fp1(old_labels, file_fld)
0213 
0214 n_old = length(old_labels);
0215 n_label = n_old;
0216 new_labels = cell(n_label,1);
0217 
0218 % --- copy old to new
0219 for i_label = 1:n_label
0220   new_labels{i_label} = old_labels{i_label};
0221 end
0222 i_new = 1;
0223 
0224 for i_old = 1:n_old
0225   if strcmp(old_labels{i_old}, 'A1')
0226     new_labels{i_new} = 'Fp1';
0227     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0228 
0229   elseif strcmp(old_labels{i_old}, 'B1')
0230     new_labels{i_new} = 'Fpz';
0231     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0232 
0233   elseif strcmp(old_labels{i_old}, 'B2')
0234     new_labels{i_new} = 'Fp2';
0235     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0236 
0237   elseif strcmp(old_labels{i_old}, 'A2')
0238     new_labels{i_new} = 'AF7';
0239     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0240     
0241   elseif strcmp(old_labels{i_old}, 'A3')
0242     new_labels{i_new} = 'AF3';
0243     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0244     
0245   elseif strcmp(old_labels{i_old}, 'B5')
0246     new_labels{i_new} = 'AFz';
0247     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0248     
0249   elseif strcmp(old_labels{i_old}, 'B4')
0250     new_labels{i_new} = 'AF4';
0251     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0252 
0253   elseif strcmp(old_labels{i_old}, 'B3')
0254     new_labels{i_new} = 'AF8';
0255     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0256 
0257   elseif strcmp(old_labels{i_old}, 'A7' )
0258     new_labels{i_new} = 'F7';
0259     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0260 
0261   elseif strcmp(old_labels{i_old}, 'A6' )
0262     new_labels{i_new} = 'F5';
0263     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0264 
0265   elseif strcmp(old_labels{i_old}, 'A5' )
0266     new_labels{i_new} = 'F3';
0267     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0268 
0269   elseif strcmp(old_labels{i_old}, 'A4' )
0270     new_labels{i_new} = 'F1';
0271     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0272 
0273   elseif strcmp(old_labels{i_old}, 'B6' )
0274     new_labels{i_new} = 'Fz';
0275     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0276 
0277   elseif strcmp(old_labels{i_old}, 'B7' )
0278     new_labels{i_new} = 'F2';
0279     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0280 
0281   elseif strcmp(old_labels{i_old}, 'B8' )
0282     new_labels{i_new} = 'F4';
0283     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0284 
0285   elseif strcmp(old_labels{i_old}, 'B9' )
0286     new_labels{i_new} = 'F6';
0287     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0288 
0289   elseif strcmp(old_labels{i_old}, 'B10' )
0290     new_labels{i_new} = 'F8';
0291     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0292 
0293   
0294   elseif strcmp(old_labels{i_old}, 'A8')
0295     new_labels{i_new} = 'FT7';
0296     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0297 
0298   elseif strcmp(old_labels{i_old}, 'A9')
0299     new_labels{i_new} = 'FC5';
0300     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0301 
0302   elseif strcmp(old_labels{i_old}, 'A10')
0303     new_labels{i_new} = 'FC3';
0304     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0305 
0306   elseif strcmp(old_labels{i_old}, 'A11')
0307     new_labels{i_new} = 'FC1';
0308     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0309 
0310   elseif strcmp(old_labels{i_old}, 'B15')
0311     new_labels{i_new} = 'FCz';
0312     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0313 
0314   elseif strcmp(old_labels{i_old}, 'B14')
0315     new_labels{i_new} = 'FC2';
0316     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0317 
0318   elseif strcmp(old_labels{i_old}, 'B13')
0319     new_labels{i_new} = 'FC4';
0320     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0321 
0322   elseif strcmp(old_labels{i_old}, 'B12')
0323     new_labels{i_new} = 'FC6';
0324     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0325 
0326   elseif strcmp(old_labels{i_old}, 'B11')
0327     new_labels{i_new} = 'FT8';
0328     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0329 
0330   elseif strcmp(old_labels{i_old}, 'A15' )
0331     new_labels{i_new} = 'T7';
0332     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0333 
0334   elseif strcmp(old_labels{i_old}, 'A14' )
0335     new_labels{i_new} = 'C5';
0336     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0337 
0338   elseif strcmp(old_labels{i_old}, 'A13' )
0339     new_labels{i_new} = 'C3';
0340     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0341 
0342   elseif strcmp(old_labels{i_old}, 'A12' )
0343     new_labels{i_new} = 'C1';
0344     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0345 
0346   elseif strcmp(old_labels{i_old}, 'B16' )
0347     new_labels{i_new} = 'Cz';
0348     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0349 
0350   elseif strcmp(old_labels{i_old}, 'B17' )
0351     new_labels{i_new} = 'C2';
0352     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0353 
0354   elseif strcmp(old_labels{i_old}, 'B18' )
0355     new_labels{i_new} = 'C4';
0356     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0357 
0358   elseif strcmp(old_labels{i_old}, 'B19' )
0359     new_labels{i_new} = 'C6';
0360     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0361 
0362   elseif strcmp(old_labels{i_old}, 'B20' )
0363     new_labels{i_new} = 'T8';
0364     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0365 
0366   
0367   elseif strcmp(old_labels{i_old}, 'A16')
0368     new_labels{i_new} = 'TP7';
0369     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0370 
0371   elseif strcmp(old_labels{i_old}, 'A17')
0372     new_labels{i_new} = 'CP5';
0373     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0374 
0375   elseif strcmp(old_labels{i_old}, 'A18')
0376     new_labels{i_new} = 'CP3';
0377     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0378 
0379   elseif strcmp(old_labels{i_old}, 'A19')
0380     new_labels{i_new} = 'CP1';
0381     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0382 
0383   elseif strcmp(old_labels{i_old}, 'A32')
0384     new_labels{i_new} = 'CPz';
0385     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0386 
0387   elseif strcmp(old_labels{i_old}, 'B24')
0388     new_labels{i_new} = 'CP2';
0389     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0390 
0391   elseif strcmp(old_labels{i_old}, 'B23')
0392     new_labels{i_new} = 'CP4';
0393     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0394 
0395   elseif strcmp(old_labels{i_old}, 'B22')
0396     new_labels{i_new} = 'CP6';
0397     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0398 
0399   elseif strcmp(old_labels{i_old}, 'B21')
0400     new_labels{i_new} = 'TP8';
0401     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0402 
0403   
0404   elseif strcmp(old_labels{i_old}, 'A24' )
0405     new_labels{i_new} = 'P9';
0406     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0407 
0408   elseif strcmp(old_labels{i_old}, 'A23' )
0409     new_labels{i_new} = 'P7';
0410     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0411 
0412   elseif strcmp(old_labels{i_old}, 'A22' )
0413     new_labels{i_new} = 'P5';
0414     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0415 
0416   elseif strcmp(old_labels{i_old}, 'A21' )
0417     new_labels{i_new} = 'P3';
0418     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0419 
0420   elseif strcmp(old_labels{i_old}, 'A20' )
0421     new_labels{i_new} = 'P1';
0422     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0423 
0424   elseif strcmp(old_labels{i_old}, 'A31' )
0425     new_labels{i_new} = 'Pz';
0426     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0427 
0428   elseif strcmp(old_labels{i_old}, 'B25' )
0429     new_labels{i_new} = 'P2';
0430     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0431 
0432   elseif strcmp(old_labels{i_old}, 'B26' )
0433     new_labels{i_new} = 'P4';
0434     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0435 
0436   elseif strcmp(old_labels{i_old}, 'B27' )
0437     new_labels{i_new} = 'P6';
0438     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0439 
0440   elseif strcmp(old_labels{i_old}, 'B28' )
0441     new_labels{i_new} = 'P8';
0442     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0443 
0444   elseif strcmp(old_labels{i_old}, 'B29')
0445     new_labels{i_new} = 'P10';
0446     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0447 
0448   
0449   elseif strcmp(old_labels{i_old}, 'A25')
0450     new_labels{i_new} = 'PO7';
0451     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0452 
0453   elseif strcmp(old_labels{i_old}, 'A26')
0454     new_labels{i_new} = 'PO3';
0455     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0456 
0457   elseif strcmp(old_labels{i_old}, 'A30')
0458     new_labels{i_new} = 'POz';
0459     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0460 
0461   elseif strcmp(old_labels{i_old}, 'B31')
0462     new_labels{i_new} = 'PO4';
0463     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0464 
0465   elseif strcmp(old_labels{i_old}, 'B30')
0466     new_labels{i_new} = 'PO8';
0467     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0468 
0469 
0470   elseif strcmp(old_labels{i_old}, 'A27' )
0471     new_labels{i_new} = 'O1';
0472     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0473 
0474   elseif strcmp(old_labels{i_old}, 'A29' )
0475     new_labels{i_new} = 'Oz';
0476     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0477 
0478   elseif strcmp(old_labels{i_old}, 'B32' )
0479     new_labels{i_new} = 'O2';
0480     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0481 
0482 
0483   elseif strcmp(old_labels{i_old}, 'A28' )
0484     new_labels{i_new} = 'Iz';
0485     inner_replace_chdata_label(file_fld, old_labels{i_old}, new_labels{i_new});
0486 
0487   end
0488   
0489   i_new = i_new + 1;
0490 end
0491 return;
0492 end
0493 %
0494 % --- end of inner_a1_to_fp1()
0495 
0496 % --- inner_set_fp1()
0497 %
0498 function base_labels = inner_sub_64_set_fp1(base_labels)
0499 
0500 i_new = 1;
0501 
0502 base_labels{i_new} = 'Fp1'; i_new = i_new + 1;
0503 base_labels{i_new} = 'Fpz';i_new = i_new + 1;
0504 base_labels{i_new} = 'Fp2';i_new = i_new + 1;
0505 base_labels{i_new} = 'AF7';i_new = i_new + 1;
0506 base_labels{i_new} = 'AF3';i_new = i_new + 1;
0507 base_labels{i_new} = 'AFz';i_new = i_new + 1;
0508 base_labels{i_new} = 'AF4';i_new = i_new + 1;
0509 base_labels{i_new} = 'AF8';i_new = i_new + 1;
0510 base_labels{i_new} = 'F7';i_new = i_new + 1;
0511 base_labels{i_new} = 'F5';i_new = i_new + 1;
0512 base_labels{i_new} = 'F3';i_new = i_new + 1;
0513 base_labels{i_new} = 'F1';i_new = i_new + 1;
0514 base_labels{i_new} = 'Fz';i_new = i_new + 1;
0515 base_labels{i_new} = 'F2';i_new = i_new + 1;
0516 base_labels{i_new} = 'F4';i_new = i_new + 1;
0517 base_labels{i_new} = 'F6';i_new = i_new + 1;
0518 base_labels{i_new} = 'F8';i_new = i_new + 1;
0519 base_labels{i_new} = 'FT7';i_new = i_new + 1;
0520 base_labels{i_new} = 'FC5';i_new = i_new + 1;
0521 base_labels{i_new} = 'FC3';i_new = i_new + 1;
0522 base_labels{i_new} = 'FC1';i_new = i_new + 1;
0523 base_labels{i_new} = 'FCz';i_new = i_new + 1;
0524 base_labels{i_new} = 'FC2';i_new = i_new + 1;
0525 base_labels{i_new} = 'FC4';i_new = i_new + 1;
0526 base_labels{i_new} = 'FC6';i_new = i_new + 1;
0527 base_labels{i_new} = 'FT8';i_new = i_new + 1;
0528 base_labels{i_new} = 'T7'; i_new = i_new + 1;
0529 base_labels{i_new} = 'C5'; i_new = i_new + 1;
0530 base_labels{i_new} = 'C3'; i_new = i_new + 1;
0531 base_labels{i_new} = 'C1'; i_new = i_new + 1;
0532 base_labels{i_new} = 'Cz'; i_new = i_new + 1;
0533 base_labels{i_new} = 'C2'; i_new = i_new + 1;
0534 base_labels{i_new} = 'C4'; i_new = i_new + 1;
0535 base_labels{i_new} = 'C6'; i_new = i_new + 1;
0536 base_labels{i_new} = 'T8'; i_new = i_new + 1;
0537 base_labels{i_new} = 'TP7'; i_new = i_new + 1;
0538 base_labels{i_new} = 'CP5'; i_new = i_new + 1;
0539 base_labels{i_new} = 'CP3'; i_new = i_new + 1;
0540 base_labels{i_new} = 'CP1'; i_new = i_new + 1;
0541 base_labels{i_new} = 'CPz'; i_new = i_new + 1;
0542 base_labels{i_new} = 'CP2'; i_new = i_new + 1;
0543 base_labels{i_new} = 'CP4'; i_new = i_new + 1;
0544 base_labels{i_new} = 'CP6'; i_new = i_new + 1;
0545 base_labels{i_new} = 'TP8'; i_new = i_new + 1;
0546 base_labels{i_new} = 'P9'; i_new = i_new + 1;
0547 base_labels{i_new} = 'P7'; i_new = i_new + 1;
0548 base_labels{i_new} = 'P5'; i_new = i_new + 1;
0549 base_labels{i_new} = 'P3'; i_new = i_new + 1;
0550 base_labels{i_new} = 'P1'; i_new = i_new + 1;
0551 base_labels{i_new} = 'Pz'; i_new = i_new + 1;
0552 base_labels{i_new} = 'P2'; i_new = i_new + 1;
0553 base_labels{i_new} = 'P4'; i_new = i_new + 1;
0554 base_labels{i_new} = 'P6'; i_new = i_new + 1;
0555 base_labels{i_new} = 'P8'; i_new = i_new + 1;
0556 base_labels{i_new} = 'P10'; i_new = i_new + 1;
0557 base_labels{i_new} = 'PO7'; i_new = i_new + 1;
0558 base_labels{i_new} = 'PO3'; i_new = i_new + 1;
0559 base_labels{i_new} = 'POz'; i_new = i_new + 1;
0560 base_labels{i_new} = 'PO4'; i_new = i_new + 1;
0561 base_labels{i_new} = 'PO8'; i_new = i_new + 1;
0562 base_labels{i_new} = 'O1'; i_new = i_new + 1;
0563 base_labels{i_new} = 'Oz'; i_new = i_new + 1;
0564 base_labels{i_new} = 'O2'; i_new = i_new + 1;
0565 base_labels{i_new} = 'Iz'; i_new = i_new + 1;
0566 
0567 return;
0568 end
0569 %
0570 % --- end of inner_set_fp1()
0571 
0572 % --- inner_replace_chdata_label()
0573 %
0574 function [result] = inner_replace_chdata_label(file_fld, old_label, new_label)
0575 data_dir = [file_fld.eegfile_dir '/' file_fld.DataDir];
0576 
0577 file_info = dir(data_dir);
0578 n_file = length(file_info);
0579 
0580 old_label_len = length(old_label);
0581 
0582 for i_file = 1:n_file
0583   old_file = file_info(i_file).name;
0584   if strncmp(old_file, old_label, old_label_len)
0585     new_file = [new_label old_file((old_label_len+1):end)];
0586     movefile([data_dir '/' old_file], [data_dir '/' new_file]);
0587     break;
0588   end
0589 end
0590 return;
0591 end
0592 %
0593 % --- end of inner_replace_chdata_label()
0594 %
0595 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0596 
0597 % --- END OF FILE --- %

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005