To bin data from a line profile in MATLAB, you can use the accumarray
function.
Assuming you have a vector lineProfile
containing your data and you want to bin it into numBins
bins, you can do the following:
main.m403 chars13 lines
In this example, binnedData
will contain the mean of the data points in each bin, and counts
will contain the count of data points in each bin. You can adjust the binning method (e.g., sum, median, etc.) by changing the function handle used in accumarray
.
gistlibby LogSnag