How to select one of the array and change the array data selected with another value ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Muhammad Hafiz
am 19 Mär. 2018
Beantwortet: Muhammad Hafiz
am 19 Mär. 2018
example :
datasample [83 84 82 81 82 86 81 85 87 *88*];
if datasample > 87
datasample = mean(datasample);
end
I want change the biggest value in datasample that is 88 with mean ( 83)
how to code like that ?
0 Kommentare
Akzeptierte Antwort
David Fletcher
am 19 Mär. 2018
Bearbeitet: David Fletcher
am 19 Mär. 2018
datasample=[83 84 82 81 82 86 81 85 87 88];
datasample(datasample==88) = mean(datasample);
or more generally
datasample(datasample==max(datasample)) = mean(datasample)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!