DaveM@8: function classList = traceLinkageToBinary(linkList, rowIndex) DaveM@8: %% class = traceLinkageToBinary(linkList, rowIndex) DaveM@8: % This function accepts a linkList and a rowIndex, and performs a transform DaveM@8: % to provide a classification list for all the data points in the original DaveM@8: % list. From a row index, if the data falls under column 1 (lower number) DaveM@8: % then it is given a class of 1, if it falls under column 2 (higher number) DaveM@8: % then it is given a class of 2. Any data not included in that branch of DaveM@8: % the hierarchy is given a class of 0 DaveM@8: % linkList - the input result from linkages DaveM@8: % rowIndex - the row on which to split the data DaveM@8: DaveM@8: listSize = size(linkList,1)+1; DaveM@8: c(1) = linkList(rowIndex,1); DaveM@8: c(2) = linkList(rowIndex,2); DaveM@24: for i = 1:2 DaveM@24: if (c(i) > listSize) DaveM@24: c(i) = c(i) - listSize; DaveM@24: end DaveM@24: end DaveM@8: DaveM@8: leafList1 = traverseDownOneStep(linkList,[],c(1)); DaveM@8: leafList2 = traverseDownOneStep(linkList,[],c(2)); DaveM@8: DaveM@8: classList = zeros(listSize,1); DaveM@24: classList(leafList1) = c(1); DaveM@24: classList(leafList2) = c(2); DaveM@8: DaveM@8: DaveM@8: end DaveM@8: