How to find which postions in a vector has negative values and output them?

조회 수: 1 (최근 30일)
i have a vector and need to find the postions which has negative values

채택된 답변

Birdman
Birdman 2018년 2월 17일
편집: Birdman 2018년 2월 17일
Say your vector is A:
idx=find(A<0)
ANeg=A(idx)

추가 답변 (1개)

Stephen23
Stephen23 2018년 2월 17일
find is not required, logical indexing is simpler and more efficient:
B = A(A<0)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by