Home > track > get_dtable.m

get_dtable

PURPOSE ^

initialize distance table

SYNOPSIS ^

function dtable = get_dtable(cells1,cells2)

DESCRIPTION ^

 initialize distance table

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dtable = get_dtable(cells1,cells2)
0002 % initialize distance table
0003 dtable = Inf*ones(cells1.nCells,cells2.nCells);
0004 
0005 % construct previous distance tables
0006 for ce1 = 1:cells1.nCells
0007     ce1_row = cells1.Cells(ce1).Row;
0008     ce1_col = cells1.Cells(ce1).Col;
0009 
0010     for ce2 = 1: cells2.nCells
0011         ce2_row = cells2.Cells(ce2).Row;
0012         ce2_col = cells2.Cells(ce2).Col;
0013         % calculate the distance of 2 cell locations
0014         distance =sqrt((ce2_row - ce1_row)^2 + (ce2_col - ce1_col)^2);
0015         % Assign into the table
0016         dtable(ce1,ce2) = distance;
0017     end
0018 end

Generated on Thu 17-Mar-2011 14:45:51 by m2html © 2005