To know what number is not available in an array.

I have an array A
A=[ 1 7 3 8 7 2 6];
Then after sorting the array A,
B=sort(A,ascending);
B=[1 2 3 6 7 8];
How can I know which number it doesnt contained? Which is 4 and 5?

 채택된 답변

Stephan
Stephan 2019년 2월 28일
편집: Stephan 2019년 2월 28일

2 개 추천

A=[ 1 7 3 8 7 2 6]
Missing = find(~ismember(min(A):max(A),A))

추가 답변 (0개)

카테고리

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

태그

질문:

2019년 2월 28일

편집:

2019년 2월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by