A=A(:)';
B=unique(A);
for x=1:length(B)
if length(find(A==B(x)))>1
C(x)=B(x);
else
C(x)=0;
end
end
C(find(C==0))=[]
例如:
A =
2 3 4 5
3 4 5 6
4 5 6 7
5 6 7 8
6 7 8 9
>> A=A(:)';
B=unique(A);
for x=1:length(B)
if length(find(A==B(x)))>1
C(x)=B(x);
else
C(x)=0;
end
end
C(find(C==0))=[]
C =
3 4 5 6 7 8