Replacing non-integer values

17 visualizzazioni (ultimi 30 giorni)
Muneer il 6 Dic 2013
Commentato: sixwwwwww il 6 Dic 2013
I have an array of all numeric values but it is a mix of integers and non-integers. How could I replace an non-integer with 0, for example? Also, the array is fairly large (about 130k rows).
Thanks in advance!

Risposte (2)

Azzi Abdelmalek
Azzi Abdelmalek il 6 Dic 2013

sixwwwwww il 6 Dic 2013
Modificato: sixwwwwww il 6 Dic 2013
If 'a' is your array then use the following:
a(arrayfun(@(x) ~isinteger(x), a)) = 0;
  8 Commenti
sixwwwwww il 6 Dic 2013
you are welcome

Accedi per commentare.


Scopri di più su Numeric Types in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by