how to remove negative numbers from a vector

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-

Antworten (1)

Stephen23
Stephen23 am 17 Feb. 2016
Bearbeitet: Stephen23 am 17 Feb. 2016

5 Stimmen

Use basic logical indexing:
>> A(A>=0)
ans =
5 0.1 0 100

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 17 Feb. 2016

Bearbeitet:

am 17 Feb. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by