how to find the largest number in the first 13 number in an array?

조회 수: 3 (최근 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

채택된 답변

madhan ravi
madhan ravi 2020년 9월 23일
max(reshape(array, [], 13))
  댓글 수: 5
madhan ravi
madhan ravi 2020년 9월 23일
How are you supposed to divide a 2000 numbers array by 13, 14 and then what?
hassan elkholy
hassan elkholy 2020년 9월 23일
then the third element in the created array will be the maximum in the next 13 number and fourth is the largest in the next 14 numbers and so on

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
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
hassan elkholy
hassan elkholy 2020년 9월 23일
thank you for your answer, yes i need that
Image Analyst
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 CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by