matlab 判断一个数组中有没有重复的元素

转:https://zhidao.baidu.com/question/197171779.html?qbl=relate_question_0

arr=[1,3,4,5,6,75,7,8];
%通过unique函数去除数组中相同的元素,然后比较俩个数组的长度
uniq=length(arr)-length(unique(arr));
%如果结果为0.则说明俩个数组中的没有相同的元素
%
if uniq==0
..............

猜你喜欢

转载自blog.csdn.net/wcx1293296315/article/details/84938677