annotate phase2/traceLinkageToBinary.m @ 8:b177d57ac0bd
adding function to traverse down linkages file and provide classification for each part of the tree
author |
DaveM |
date |
Fri, 10 Feb 2017 08:28:22 +0000 |
parents |
|
children |
8613ec5ab369 |
rev |
line source |
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@8
|
15
|
DaveM@8
|
16 leafList1 = traverseDownOneStep(linkList,[],c(1));
|
DaveM@8
|
17 leafList2 = traverseDownOneStep(linkList,[],c(2));
|
DaveM@8
|
18
|
DaveM@8
|
19 classList = zeros(listSize,1);
|
DaveM@8
|
20 classList(leafList1) = 1;
|
DaveM@8
|
21 classList(leafList2) = 2;
|
DaveM@8
|
22
|
DaveM@8
|
23
|
DaveM@8
|
24 end
|
DaveM@8
|
25
|