More efficient alternative to find()
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Chun Hei Chan
am 4 Aug. 2023
Kommentiert: Chun Hei Chan
am 4 Aug. 2023
Hello,
I am working on some simulation data and I would like to find the maximum element in each randomly generated vector which has no inherent pattern. Is there any more efficient alternative to the find() function in this case since Profiler says that find() is taking up a significant proportion of the compile time.
Many thanks.
0 Kommentare
Akzeptierte Antwort
John D'Errico
am 4 Aug. 2023
Bearbeitet: John D'Errico
am 4 Aug. 2023
Why does max not do what you want? There are TWO returns from max.
X = randi(100,[1,10])
[xmax,maxloc] = max(X)
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!