Introduction - If you have any usage issues, please Google them yourself
The basic idea is optimal partition for a given data sequence and hierarchical number divided by searching all possible solutions to find the segment and the sum of the squared deviations smallest division of a scheme as a final solution. This gives the optimal segmentation Matlab source