检查大型矩阵matlab中的重复条目 [英] Check for duplicate entries in a large matrix matlab

查看:124
本文介绍了检查大型矩阵matlab中的重复条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常大的矩阵(901x1801),它是通过组合三个相似的数组(在其中重复的值)的值来生成的,以使用数学表达式生成唯一的代码。矩阵填充了这些代码。



我的问题是...如何检查矩阵(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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆