Two Same max Values of a Array
Ältere Kommentare anzeigen
I want to find and increase the Value of an Array by 1.
But I also want to look into cases with multiple maximas with the same value.
A = [22 22 17 18 12];
[val,idx]= max(A);
A(idx)= A(idx)+1;
By default it increases the first element of the array. In my case it should select the second one or should increase it randomly if there are multiple maximas.
Any help would be appreciated.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Aerospace Blockset finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!