How to keep only positive values in an array?

475 visualizaciones (últimos 30 días)
Priyanka Roy
Priyanka Roy el 1 de Sept. de 2015
Comentada: per isakson el 1 de Sept. de 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?

Respuesta aceptada

per isakson
per isakson el 1 de Sept. de 2015
Editada: per isakson el 1 de Sept. de 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
>>

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by