How to keep only positive values in an array?

조회 수: 95 (최근 30일)
Priyanka Roy
Priyanka Roy 2015년 9월 1일
댓글: per isakson 2015년 9월 1일
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일
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개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by