view phase2/traceLinkageToBinary.m @ 12:d0bd98e7b6c9

fixing error where crash at end of file, for treeLinkFeatures
author DaveM
date Fri, 10 Feb 2017 14:32:07 +0000
parents b177d57ac0bd
children 8613ec5ab369
line wrap: on
line source
function classList = traceLinkageToBinary(linkList, rowIndex)
%% class = traceLinkageToBinary(linkList, rowIndex)
% This function accepts a linkList and a rowIndex, and performs a transform
% to provide a classification list for all the data points in the original
% list. From a row index, if the data falls under column 1 (lower number)
% then it is given a class of 1, if it falls under column 2 (higher number)
% then it is given a class of 2. Any data not included in that branch of
% the hierarchy is given a class of 0
% linkList - the input result from linkages
% rowIndex - the row on which to split the data

listSize = size(linkList,1)+1;
c(1) = linkList(rowIndex,1);
c(2) = linkList(rowIndex,2);

leafList1 = traverseDownOneStep(linkList,[],c(1));
leafList2 = traverseDownOneStep(linkList,[],c(2));

classList = zeros(listSize,1);
classList(leafList1) = 1;
classList(leafList2) = 2;


end