How to find max values in vector for each 10 rows
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
A=rand(1, 100)
For each 10 rows, i want to find max value
0 Commenti
Risposta accettata
Jan
il 29 Dic 2022
Modificato: Jan
il 29 Dic 2022
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 Commenti
Walter Roberson
il 29 Dic 2022
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
il 29 Dic 2022
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!