Extracting specific numbers from a vector
조회 수: 11 (최근 30일)
이전 댓글 표시
How can I extract a specific number from a vector, saving the new vector minus the extracted number as a new variable, and saving the counted extracted number as a new variable?
eg. Extracting '-20' from the following.
A = [2 4 6 5 6 5 4 3 -20 4 6 7 -20 3 4 5 6 1 -20];
A1 = [2 4 6 5 6 5 4 3 4 6 7 3 4 5 6 1];
A2 = 3
댓글 수: 0
답변 (2개)
Azzi Abdelmalek
2016년 8월 19일
편집: Azzi Abdelmalek
2016년 8월 19일
idx=ismember(A,-20)
A1=A(~idx)
A2=sum(idx)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Dynamic System Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!