DaveM@8
|
1 function classList = traceLinkageToBinary(linkList, rowIndex)
|
DaveM@8
|
2 %% class = traceLinkageToBinary(linkList, rowIndex)
|
DaveM@8
|
3 % This function accepts a linkList and a rowIndex, and performs a transform
|
DaveM@8
|
4 % to provide a classification list for all the data points in the original
|
DaveM@8
|
5 % list. From a row index, if the data falls under column 1 (lower number)
|
DaveM@8
|
6 % then it is given a class of 1, if it falls under column 2 (higher number)
|
DaveM@8
|
7 % then it is given a class of 2. Any data not included in that branch of
|
DaveM@8
|
8 % the hierarchy is given a class of 0
|
DaveM@8
|
9 % linkList - the input result from linkages
|
DaveM@8
|
10 % rowIndex - the row on which to split the data
|
DaveM@8
|
11
|
DaveM@8
|
12 listSize = size(linkList,1)+1;
|
DaveM@8
|
13 c(1) = linkList(rowIndex,1);
|
DaveM@8
|
14 c(2) = linkList(rowIndex,2);
|
DaveM@24
|
15 for i = 1:2
|
DaveM@24
|
16 if (c(i) > listSize)
|
DaveM@24
|
17 c(i) = c(i) - listSize;
|
DaveM@24
|
18 end
|
DaveM@24
|
19 end
|
DaveM@8
|
20
|
DaveM@8
|
21 leafList1 = traverseDownOneStep(linkList,[],c(1));
|
DaveM@8
|
22 leafList2 = traverseDownOneStep(linkList,[],c(2));
|
DaveM@8
|
23
|
DaveM@8
|
24 classList = zeros(listSize,1);
|
DaveM@24
|
25 classList(leafList1) = c(1);
|
DaveM@24
|
26 classList(leafList2) = c(2);
|
DaveM@8
|
27
|
DaveM@8
|
28
|
DaveM@8
|
29 end
|
DaveM@8
|
30
|