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-

답변 (1개)

Stephen23
Stephen23 2016년 2월 17일
편집: Stephen23 2016년 2월 17일

5 개 추천

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

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

질문:

2016년 2월 17일

편집:

2016년 2월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by