MATLAB: How to group data points

group data points

Hello,
I have a set of data that I would like to perform analysis on, and it's something like:
[150 151.1 149.6 150.2 146.1 145.6 144.1 144.9 145.2 139.9 140.6 138.9 135.4 135.1 134.9 135.9 135.2 129.9 129.89 130.6]
I would like to group the data to 150, 145, 140, etc… I have tried to manipulate it using rounding/ceiling, etc.. but I couldnt figure out how to group it correctly because it varies too much, and another problem is that the number of data points arent always the same. Once I can group it, I would like to find the average of the data for each set. Is there a way to do this?
Thanks for the help!

Best Answer

X=floor(X/5)*5