I am using this command "splitapply" in order to find mean (average) of a group of data.
[N, edges, bin] = histcounts(B, edges);
mean_B=splitapply(@mean, B, bin)
But command window shows me :
Error using splitapply (line 61)
Group numbers must be a vector of positive integers, and cannot be a sparse vector.
which is curiousness because for an another set of data code runs.
Could you please help me?