Checking a 1x24 Array for numbers less than 0

1 vue (au cours des 30 derniers jours)
Calvin Wynn
Calvin Wynn le 16 Nov 2016
Modifié(e) : Changoleon le 16 Nov 2016
I need assistance with changing a number less than 0 in an array to 0. I attempted to program this but I am lost. Any help would be appreciated.

Réponse acceptée

Changoleon
Changoleon le 16 Nov 2016
Modifié(e) : Changoleon le 16 Nov 2016
for example if a is the matrix
a = [ 0 2 1 -9 -8 6 100 -63 1 2 5];
you can do following
a(a<0)=0;
Now a has just the values equal or greater than zero

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by