hello If I have for example a vector k=[1,2,3,4,5,6,7,8] and a vector i=[3,4,6,7] and I want to obtain a vector that contains element in k but not in i, it means here I want the vector [1,2,5,8] thanks in advance

 채택된 답변

per isakson
per isakson 2016년 12월 9일

1 개 추천

setdiff does it
>> k=[1,2,3,4,5,6,7,8]; i =[3,4,6,7];
>> setdiff( k, i )
ans =
1 2 5 8

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Modeling에 대해 자세히 알아보기

태그

질문:

2016년 12월 9일

댓글:

2016년 12월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by