function k=plotcortree(lmat,h)

%rearrange the matrix

for k=1:h
    upperMat(:,:,k) = triu(lmat(:,:,k),1);
    myVec = nonzeros(upperMat(:,:,k)');
    Z= linkage(myVec','average');
    [H,T] = dendrogram(Z,'colorthreshold','default');
end
