corresponding elements of a setdiff of another variable
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello, I have a question about setdiff. I have three variables X ,Y, p. I need to find elements of Y excluding elements of p and corresponding elements of X (corresponding to Y). I ran the following (Both X and Y have same number of elements).
y=setdiff(Y,p);
x= X(setdiff(Y,p)); this doesn't work. Any solutions?
Thanks,
Bharat
댓글 수: 0
채택된 답변
Andrei Bobrov
2015년 7월 14일
편집: Andrei Bobrov
2015년 7월 14일
x = X(~ismember(Y,p));
or
[~,ii] = setdiff(Y,p);
x = X(ii);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!