How to keep only positive values in an array?

475 vues (au cours des 30 derniers jours)
Priyanka Roy
Priyanka Roy le 1 Sep 2015
Commenté : per isakson le 1 Sep 2015
I have a sorted array with different values: -18 -13 0 8 51 133 255
I only keep the positive values : 0 8 51 133 255
How do i do this?
  1 commentaire
per isakson
per isakson le 1 Sep 2015
How do the tags relate to the question?

Connectez-vous pour commenter.

Réponse acceptée

per isakson
per isakson le 1 Sep 2015
Modifié(e) : per isakson le 1 Sep 2015
Given 1D-array, i.e a vector
>> A = [ -18 -13 0 8 51 133 255]
A =
-18 -13 0 8 51 133 255
>> B = A( A>=0 )
B =
0 8 51 133 255
>>

Plus de réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by