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개)
Use basic logical indexing:
>> A(A>=0)
ans =
5 0.1 0 100
카테고리
도움말 센터 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!