how to remove negative numbers from a vector

41 visualizaciones (últimos 30 días)
KIRAN MUKUND
KIRAN MUKUND el 17 de Feb. de 2016
Editada: Stephen23 el 17 de Feb. de 2016
Hi,
Let
A=[5 -0.4 0.1 0 100 -10]
in that i want to remove all -ve numbers and print refined vector A
please help !!!! -kiran mukund-

Respuestas (1)

Stephen23
Stephen23 el 17 de Feb. de 2016
Editada: Stephen23 el 17 de Feb. de 2016
Use basic logical indexing:
>> A(A>=0)
ans =
5 0.1 0 100

Categorías

Más información sobre Operators and Elementary Operations 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