Azzera filtri
Azzera filtri

How to replace numbers in an array

102 visualizzazioni (ultimi 30 giorni)
zhe li
zhe li il 8 Nov 2011
Commentato: maede parishani il 15 Feb 2023
Could anybody help me solve the problem please? I have a sample array a=[3 2 5 7 4 8 2 5], I would like to replace all numbers greater than 5(>5) to be 5, the expected result should be a=[3 2 5 5 4 5 2 5]. Thank you very much.

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 8 Nov 2011
  2 Commenti
zhe li
zhe li il 8 Nov 2011
Thank you very much, Andrei.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by