i have two array A ,B i need to know all elements that inside A but not B including reptitons ,thx .

 채택된 답변

Star Strider
Star Strider 2018년 11월 27일
편집: Star Strider 2018년 11월 27일

1 개 추천

Experiment with the ismember (link) funciton or if you are using floating-point numbers, ismembertol (link):
A = randi(9, 1, 10)
B = randi(5, 1, 8)
L = ismember(A, B)
Out = A(L)
or:
Out = A(~L)
depending on the result you want.

댓글 수: 2

daniel zayed
daniel zayed 2018년 11월 27일
thx :)
Star Strider
Star Strider 2018년 11월 27일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

질문:

2018년 11월 27일

댓글:

2018년 11월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by