在MATLAB中提取矩阵的子集 [英] Pulling a subset of a matrix in MATLAB

查看:660
本文介绍了在MATLAB中提取矩阵的子集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对一个数组进行聚类,该数组包含某个角度,我想计算这些度之间的差,并选择此数组之间的一组,该组应具有最大数量,而该成员之间的差不应大于特定数字.

I want to cluster an array, this array contain some angle I want to calculate the difference between of these degree and select one group between this array, this group should have maximum number and the difference between the member of that should not be larger than specific number.

例如,如果特定号码为 30 并且数组是

for example if specific number is 30 and array is

[10 20 30 40 100 120 140]

答案应为

[10 20 30 40]

100- 30 > = 30 ,因此不包括在内.

100-30 >= 30 so it is not included.

推荐答案

单行解决方案:

a = [10 20 30 40 100 120 140];
s = 30;

b = a( abs(a-s) < s )

这篇关于在MATLAB中提取矩阵的子集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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