How to find max values in vector for each 10 rows
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
abdullah al-dulaimi
am 29 Dez. 2022
Kommentiert: Jan
am 29 Dez. 2022
A=rand(1, 100)
For each 10 rows, i want to find max value
0 Kommentare
Akzeptierte Antwort
Jan
am 29 Dez. 2022
Bearbeitet: Jan
am 29 Dez. 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 Kommentare
Walter Roberson
am 29 Dez. 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
am 29 Dez. 2022
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!