how to find the largest number in the first 13 number in an array?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
hassan elkholy
el 23 de Sept. de 2020
Comentada: Image Analyst
el 23 de Sept. de 2020
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 comentarios
Respuesta aceptada
madhan ravi
el 23 de Sept. de 2020
max(reshape(array, [], 13))
5 comentarios
madhan ravi
el 23 de Sept. de 2020
How are you supposed to divide a 2000 numbers array by 13, 14 and then what?
Más respuestas (1)
Image Analyst
el 23 de Sept. de 2020
Editada: Image Analyst
el 23 de Sept. de 2020
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 comentarios
Image Analyst
el 23 de Sept. de 2020
Looks like you figured it out since you've accepted Madhan's answer, so I won't spend my time on it.
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!