separate a column according to a histogram

1 view (last 30 days)
Hi there, I have a data sheet of two columns (millions data points), the first one is the timing, and the second is the corresponding intensity. the data points in a constant bin is different, is there a smart way to separate the 2nd column according to the histogram of the 1st column? for instance, in the first second, there are 2 points, 7 for the 2nd sec, and 3 for the 3rd sec. how do I frequency count the 2nd column based on the frequency of the 1st column? any suggestions would be greatly appreciated.
0.85216
0.97547
1.24458
1.30496
1.36451
1.60435
1.75188
1.78986
1.88271
1.96502
2.16654
2.68219
2.88473
3.32168
3.35361
3.49613
3.50566
3.56686
3.70634
3.88316
3.92481
4.0819
4.10702
4.20151
4.39459
4.54795
4.69639
4.84201
5.06737
5.07738
2358
1182
3323
3113
3562
2408
2594
2621
2621
2567
1883
2375
1444
1414
1134
1143
2364
1176
2614
534
1295
1179
1544
3944
571
3374
2381
579
2762
2822
  5 Comments
Zhiyu
Zhiyu on 16 Jan 2015
sorry, the system does not show the data as columns.

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 16 Jan 2015
Edited: Azzi Abdelmalek on 16 Jan 2015
a=[0.85216
0.97547
1.24458
1.30496
1.36451
1.60435
1.75188
1.78986
1.88271
1.96502
2.16654
2.68219
2.88473]
b=[2358
1182
3323
3113
3562
2408
2594
2621
2621
2567
1883
2375
1444]
c=accumarray(fix(a)+1,b)
  2 Comments
Azzi Abdelmalek
Azzi Abdelmalek on 16 Jan 2015
Or maybe you want this
c=accumarray(fix(a)+1,(1:numel(a))',[],@(x) {[a(x) b(x)]})
celldisp(c)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!