Fun problem: Dividing a dataset into parts depending on mean value Ok, so I have some recorded data over several hours that looks like this (values on y, time on x).
See this image http://imgur.com/fdakUlk
I need a way to use matlab to divide the data into sections depending on their mean value. The sections needs to be atleas a couple of hours. Just by looking at the data they can easily be spotted, see this image: http://imgur.com/svrP79h
Is there a good method of doing this? What do I need to research?

Thanks
Try total variation denoising. Here I found a piecewise constant toolbox: http://www.maxlittle.net/software/pwctools.zip