I have a large data base that looks like the following:
Energy position
5.639792 1.36
4.844813 1.89
4.809105 2.33
3.954150 2.69
2.924234 3.42
1.532669 4.50
0.000000 5.63
The actual data contains thousands of rows. The first column of the data is the particle energy and second column is the particle position. The goal of the program is to create an array (or vector) that will store the values of the energy in different position bins. For the example data shown above, I would create an array with dimensions 1 x 6. For example, the first bin of the array would contain the sum of all energies with positions between 1.0 and 1.9. In this case, the first bin for the data shown above would have a value of 5.639792 + 4.844813 = 10.4846 (the sum of the first two energies). Similarly, the second position bin would contain 8.8452 the sum of the third and fourth energies. To implement this program I believe I need to use a floor ceiling function to assign the data into the proper position bin of the array. I'm not sure how to approach this problem. Any suggestions would be greatly appreciated.