How to keep only positive values in an array?
233 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Priyanka Roy
il 1 Set 2015
Commentato: per isakson
il 1 Set 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?
Risposta accettata
per isakson
il 1 Set 2015
Modificato: per isakson
il 1 Set 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
>>
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox 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!