Sort Group Data Trends
显示 更早的评论
Suppose you had a vector
A =
1.2
1.3
1.4
1.5
2.4
2.5
2.6
2.7
2.8
2.9
4.1
4.2
4.3
4.4
4.6
4.7
Is it possible to sort this data into groups automatically without knowing if your vector has groups in 1.X, 2.X or 4.X ? Is it possible to detect a trend?
Group#1:
1.2
1.3
1.4
1.5
Group#2:
2.4
2.5
2.6
2.7
2.8
2.9
Group#3:
4.1
4.2
4.3
4.4
4.6
4.7
3 个评论
There are several ways for doing this, but you'll have to define the purpose for us to be able to tell you what is most adapted.
Simple example,
A(A>=1 & A<2)
will return all elements in the range [1,2[. Other examples could involve ACCUMARRAY, HIST, HISTC, CONV, etc.
Sven
2013-4-3
So how to you know that there are three groups?
If your criteria is "my human brain looked at the numbers and using all my years experience with numbers and the knowledge of my current problem I chose 3", then things will be difficult.
If instead you can describe a thought process such as:
- I took the smallest number (7885) and saw it had 4 digits
- I divided all numbers by 10E(4-1)
- I rounded all the numbers, and grouped by the result.
... then we might be able to do something.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!