Check for duplicate entries in a large matrix matlab
duplicates, matlab
Solution
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.
Problem
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.