how to remove negative numbers from a vector

46 vues (au cours des 30 derniers jours)
KIRAN MUKUND
KIRAN MUKUND le 17 Fév 2016
Modifié(e) : Stephen23 le 17 Fév 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-

Réponses (1)

Stephen23
Stephen23 le 17 Fév 2016
Modifié(e) : Stephen23 le 17 Fév 2016
Use basic logical indexing:
>> A(A>=0)
ans =
5 0.1 0 100

Catégories

En savoir plus sur Operators and Elementary Operations 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