How to find max values in vector for each 10 rows
3 次查看(过去 30 天)
显示 更早的评论
A=rand(1, 100)
For each 10 rows, i want to find max value
0 个评论
采纳的回答
Jan
2022-12-29
编辑:Jan
2022-12-29
With the bold guess, that you mean rand(100, 1) instead of rand(1:100):
data = rand(100, 1);
result = max(reshape(data, 10, 10))
% or explicitly:
result = max(reshape(data, 10, 10), [], 1)
3 个评论
Walter Roberson
2022-12-29
are you looking for maximum value minus 1? If so subtract 1 from result
Or are you looking for the indices where the maximums appear? Or for the indices where the second highest appear?
Jan
2022-12-29
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!