hi, my array=[ 1 2 4 5 16 18 21 28 36 38..............], i need to find max value within every 10 numbers,(i.e, my answers=[5 18 28 38...............]).
1 次查看(过去 30 天)
显示 更早的评论
i dont know to explain clearly in english, sorry.
采纳的回答
Walter Roberson
2016-11-3
I suspect that you want a sliding maximum. One way to do that is
max( buffer(data, 10))
Another way is to use the image processing toolbox morphological routines. I seem to recall that dilation corresponds to max but I could be mistaken.
You could also loop.
3 个评论
Walter Roberson
2016-11-3
Thanks, Guillaume, I went looking for such a function but could not find it; it is not cross-linked in the moving average routines.
更多回答(1 个)
KSSV
2016-11-3
data = rand(1,100) ; % some random data
data1 = reshape(data,10,[]) ; % reshape to matrix with 10 rows
val = max(data1) ; % get maximum
10 个评论
Walter Roberson
2016-11-3
That error about subscript indices tells us that you created a variable named max. If you have a variable named max then you can not call the MATLAB max() routine in the same scope.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!