Home > bioelectromagnetism > elec_distance_nn.m

elec_distance_nn

PURPOSE ^

elec_distance_nn - Identify distance between nearest neighbour electrodes.

SYNOPSIS ^

function [NN_e, NN_d] = elec_distance_nn(dist_e, dist_d)

DESCRIPTION ^

 elec_distance_nn - Identify distance between nearest neighbour electrodes.

 Requires input data generated by 'elec_distance.m'

 Usage: [NN_e, NN_d] = elec_distance_nn(dist_e, dist_d)

 where: dist_e & dist_d are derived from 'elec_distance'
        utility and NN_e and NN_d are matrices that contain
        nearest neighbour electrode labels and distances,
        respectively.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [NN_e, NN_d] = elec_distance_nn(dist_e, dist_d)
0002 
0003 % elec_distance_nn - Identify distance between nearest neighbour electrodes.
0004 %
0005 % Requires input data generated by 'elec_distance.m'
0006 %
0007 % Usage: [NN_e, NN_d] = elec_distance_nn(dist_e, dist_d)
0008 %
0009 % where: dist_e & dist_d are derived from 'elec_distance'
0010 %        utility and NN_e and NN_d are matrices that contain
0011 %        nearest neighbour electrode labels and distances,
0012 %        respectively.
0013 %
0014 
0015 % $Revision: 1.1 $ $Date: 2004/11/12 01:32:33 $
0016 
0017 % Licence:  GNU GPL, no implied or express warranties
0018 % History:  05/2000, Darren.Weber_at_radiology.ucsf.edu
0019 %
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022   fprintf('\n%s\n\n', 'Calculating nearest neighbour electrode distances.');
0023 
0024   NN_e = cell(0);
0025   NN_d = [];
0026 
0027   for r = 1:length(dist_d(:,1))
0028 
0029        % Sort row r of dist_d in ascending order
0030 
0031        [NN_d(end + 1,:), index] = sort(dist_d(r,:));
0032         
0033        % Sort electrode labels in same order
0034 
0035        NN_e(end + 1,:) = dist_e(r,index);
0036 
0037   end

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003