# Sort Group Data Trends

조회 수: 2(최근 30일)
T 2013년 4월 3일
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표시 이전 댓글 수: 2숨기기 이전 댓글 수: 2
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:
1. I took the smallest number (7885) and saw it had 4 digits
2. I divided all numbers by 10E(4-1)
3. I rounded all the numbers, and grouped by the result.
... then we might be able to do something.

댓글을 달려면 로그인하십시오.

### 채택된 답변

Sven 2013년 4월 3일
편집: Sven 2013년 4월 3일
Anthony, here's a solution relevant to my comment above. Note that there are in fact 4 groups: 7k, 8k, 11k, and 15k.
nums = [7885.93420752164
7929.78836160714
7936.53852291667
7945.56820951705
7954.26671073718
7961.92029910714
7968.44986160714
7983.83251
7988.44219642857
8014.91854589844
11128.7494221591
11174.72721875
11177.7595013587
11181.1245013587
11184.4331732955
11187.3921853147
11190.4290520833
11241.0803513889
11250.4949040616
11284.1499960937
15498.1340036932
15525.80777125
15533.8052548077
15542.8122678571
15551.8893194444
15559.6083854167
15565.6444630682
15587.30253125
15595.4106951531
15623.6680576002]
minDigits = length(num2str(round(min(nums))));
rescaledNums = nums/ 10^(minDigits-1);
[grpPrefixes ,~,groups] = unique(floor(rescaledNums))
grpPrefixes =
7
8
11
15
##### 댓글 수: 3표시 이전 댓글 수: 2숨기기 이전 댓글 수: 2
T 2013년 4월 4일
I'll look into it. Thanks!

댓글을 달려면 로그인하십시오.

### 범주

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!

Translated by