To know what number is not available in an array.

1 次查看(过去 30 天)
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
A=[ 1 7 3 8 7 2 6]
Missing = find(~ismember(min(A):max(A),A))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by