separate a column according to a histogram

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 commentaires

Zhiyu
Zhiyu le 16 Jan 2015
sorry for the displaying of the data points, it suppose to be two columns. the first line is the time, and second is the corresponding intensity.
Azzi Abdelmalek
Azzi Abdelmalek le 16 Jan 2015
the question is not clear, can you explain with less data, and show the expected result
Zhiyu
Zhiyu le 16 Jan 2015
Modifié(e) : Azzi Abdelmalek le 16 Jan 2015
ok, let's see I have a 2 columns and 10 numbers in each, the first column is the timing of detection events, and the 2nd is the signal intensity. but the frequency of detection could be different in each time interval. for this 10 detection, 2 was recorded in 1st second, 5 in the 2nd sec, and 3 in the 3rd sec. now I want to bin the 2nd column with 1 sec, and the expected result would be as follows:
0.85216 2358
0.97547 1182
1.24458 3323
1.30496 3113
1.36451 3562
1.60435 2408
1.75188 2594
2.16654 1883
2.68219 2375
2.88473 1444
so that the average intensity in each time interval can be calculated.
Zhiyu
Zhiyu le 16 Jan 2015
sorry, the system does not show the data as columns.
Azzi Abdelmalek
Azzi Abdelmalek le 16 Jan 2015
where is the expected result?

Connectez-vous pour commenter.

 Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 16 Jan 2015
Modifié(e) : Azzi Abdelmalek le 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 commentaires

Or maybe you want this
c=accumarray(fix(a)+1,(1:numel(a))',[],@(x) {[a(x) b(x)]})
celldisp(c)
Zhiyu
Zhiyu le 16 Jan 2015
thank you so much, it works!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by