How to keep only positive values in an array?

I have a sorted array with different values: -18 -13 0 8 51 133 255
I only keep the positive values : 0 8 51 133 255
How do i do this?

 채택된 답변

per isakson
per isakson 2015년 9월 1일
편집: per isakson 2015년 9월 1일

17 개 추천

Given 1D-array, i.e a vector
>> A = [ -18 -13 0 8 51 133 255]
A =
-18 -13 0 8 51 133 255
>> B = A( A>=0 )
B =
0 8 51 133 255
>>

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

2015년 9월 1일

댓글:

2015년 9월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by