필터 지우기
필터 지우기

How to extract a vector from a vector given a reference vector ?

조회 수: 1 (최근 30일)
RuiQi
RuiQi 2016년 12월 23일
답변: KSSV 2016년 12월 23일
I have a main vector = [1 1 1 1 2 3 4 5 7 8 8 8 2 2 1 1 1 .....] and a reference vector = [1 3 4 7 9 1312] how do i extract the vector in main whose value are in reference vector ?
so it should be [1 1 1 1 3 4 7]

채택된 답변

KSSV
KSSV 2016년 12월 23일
A = [1 1 1 1 2 3 4 5 7 8 8 8 2 2 1 1 1] ;
B = [1 3 4 7 9 13 12] ;
iwant = A(ismember(A,B))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Denoising and Compression에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by