检查大型矩阵matlab中的重复条目 [英] Check for duplicate entries in a large matrix matlab
问题描述
我的问题是...如何检查矩阵(901x1801)的每个值是唯一的,甚至不会重复时间?
或...
任何人都可以告诉我如何通过组合三个类似元素的数组来生成一个矩阵,每个生成的值将会是独一无二的
早期回复将非常可观。
提前感谢
使用大矩阵 M
,获取所有唯一的值,使用:
uniqueValues = unique(M(:))
然后,要了解是否有重复的值,可以使用:
repeatedValuesFound = numel(uniqueValues)〜= numel(M);
也就是说,如果唯一值数组与原始数组具有相同数量的元素,那么原始数组的所有元素必须是唯一的。
I have a very large matrix (901x1801) which I generated by combining values of three similar arrays (with repeated values in them) to generate unique codes using a mathematical expression. The matrix is filled with these codes.
My question is... How can I check that each values of the matrix (901x1801) is unique and not repeating even a single time?
Or... Can anyone tell me how can I generate a matrix by combining three arrays of similar elements in a way that each generated value will be unique.
an early reply will be greatly appciable. Thanks in advance.
With a large matrix M
, to get all the unique values, use:
uniqueValues = unique(M(:));
Then, to understand if there were any repeated values, you could use:
repeatedValuesFound = numel(uniqueValues) ~= numel(M);
That is, if the array of unique values has the same number of elements as the original array, then all elements of the original array must be unique.
这篇关于检查大型矩阵matlab中的重复条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!