Clear Filters
Clear Filters

How do I find the max value over specific intervals of a column vector?

2 views (last 30 days)
I have a column vector of 500 values of data that I need to find max values of and I would like to use a for loop to do it. I want to find the maximum value over every 10 data values, e.g. taking all of those 10 points and finding the maximum, and repeating this process for the next 10 values (1-10),(11-20), and so on. I've tried looping with specific steps but it doesn't work and I get some variation of the maximum of the entire list or just the specific points where the loop starts (1, 11, etc.). Could anyone point me in the right direction?

Answers (1)

Roger Stafford
Roger Stafford on 3 Nov 2017
mx = max(reshape(M,10,[]),[],1);

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!