필터 지우기
필터 지우기

how delete all the negative values

조회 수: 18 (최근 30일)
karthik suresh
karthik suresh 2016년 11월 8일
답변: Thorsten 2016년 11월 8일
i have vector with positive values and negative for eg
-0.26476
-0.27643
-0.24648
+0.02679
+0.0546
-0.2000
+0.5545
+....
+.....
i would like to delete all the values until the last negative value
k_2 = find(removing <= 0);
s_u(k_2)=[];
it selectively deletes all the negative values.
and when i use
k_2 = find(removing <= 0);
s_u(1:k_2)=[];
it does nothing
thank you

채택된 답변

Thorsten
Thorsten 2016년 11월 8일
x = x(find(x < 0, 1, 'last'):end);

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by