MATLAB: How to tak average of certain intervals on the graph

averagedatafilterflagImage Processing ToolboxintervalmeannoisesignalSignal Processing Toolbox

Hi Guys,
Could you help me write an algorithm that would capture mean values of particular intervals that I'm interested in? Intervals are marked: http://imageshack.us/f/694/mchg.png/
I have a flag that captures the interval of the picture itself from a larger graph and then, I need to capture those smaller intervals.
Thanks a lot, Nurlan

Best Answer

If you know the x values (indexes), wouldn't it just be
meanInsideInterval = mean(y(index1:index2));