Sort Group Data Trends
Show older comments
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 Comments
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
on 3 Apr 2013
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.
Accepted Answer
More Answers (0)
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!