How to average the values in the third column with respect to some interval in first column??
1 view (last 30 days)
Show older comments
Hi I have a problem in analyzing a matrix. Suppose i have m*3 matrix having values of latitude, longitudes and height, for example say (0.01,0.5,0.8,1.0,2.5,3.6,5.6,40.0,37.5.....n; 88.9,60.5, 60.6, 87.5, 85.3,99.9, 84.6, 89.5, 90.3, 60.5, 61.3 ....n; 455, 481, 452, 355,............n); the latitude and longitudes values are not ascending or descending, these are scattered values.. if i have to average the values in the third column i.e., height for some interval in the first column i.e., latitude 0-2, 2-4, 4-6.....38-40 (0:2:40) how can i do it sir? please help ...thanks again
0 Comments
Accepted Answer
Jos (10584)
on 7 Apr 2014
[~,idx] = histc(LatitudeValues, 0:2:40)
result = accumarray(idx, HeightValues, [], @mean)
4 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!