how to find the largest number in the first 13 number in an array?
1 次查看(过去 30 天)
显示 更早的评论
in a new array, i need to exract the largest number in the first 13 numbers in a certain array then the largest number in the 14 numbers and this process repeated
how can i write this in m file , please
0 个评论
采纳的回答
更多回答(1 个)
Image Analyst
2020-9-23
编辑:Image Analyst
2020-9-23
Try this:
numElements = 154*13;
data = rand(numElements, 1); % random numbers from 0 to 1
data2D = reshape(data, 13, [])'
theLargest = max(data2D, [], 2);
plot(theLargest, 'b.-', 'LineWidth', 2);
grid on;
xlabel('Set of 13');
Do you rather need to alternate 13, 14, 13, 14, 13, 14, etc.?
2 个评论
Image Analyst
2020-9-23
Looks like you figured it out since you've accepted Madhan's answer, so I won't spend my time on it.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!