0001
0002
0003
0004
0005 fpath = '/afs/cmb.ucdavis.edu/share/matlab/janata/eeg/electrode_files';
0006
0007 files = {'biosemi_128ch.txt', ...
0008 'biosemi_256ch.txt'};
0009
0010 nfiles = length(files);
0011
0012 for ifile = 1:nfiles
0013 fname = fullfile(fpath, files{ifile});
0014 fprintf('Converting file: %s\n', fname);
0015
0016 eloc = readlocs(fname,'filetype','custom',...
0017 'format',{'labels','custom1','custom2','custom3'});
0018
0019 nchan = length(eloc);
0020 for ichan = 1:nchan
0021
0022 eloc(ichan).sph_phi = -abs(eloc(ichan).custom1)+90;
0023
0024
0025 eloc(ichan).sph_theta = eloc(ichan).custom2-90*sign(eloc(ichan).custom1);
0026 end
0027
0028
0029 rmfield(eloc,{'custom1','custom2','custom3'});
0030
0031
0032 [fpath,fstub] = fileparts(fname);
0033 outfname = fullfile(fpath, sprintf('%s.ced',fstub));
0034 fprintf('Writing new electrode location file to: %s\n', outfname);
0035 writelocs(eloc,outfname,'filetype','chanedit');
0036 end