While using the function consolidator (https://www.mathworks.com/matlabcentral/fileexchange/8354-consolidator), I noticed a bug which occurs when there are no replicates in the x-value ("index").
For example, consider the following scenario,
x = [0;1;1];
y = [1;2;3];
[xc,yc] = consolidator(x,y,@(x)log(mean(x)));
The desired output is:
yc = [log(1); log(5/2)]
But the actual output is:
yc = [1; log(5/2)]
So I think because the x-value 0 is not replicated, the function simply ignores the corresponding value in y, not applying the function to it. I'm wondering if there is a simple fix for this. I'm not sure if this is an intended effect for whatever purpose this function was designed to serve.
EDIT: so I've found a related problem that happens when trying to use functions such as @(x) mean(x) * log(mean(x)). This throws an error asking for (.*) to be used, which gives the wrong answer.
MATLAB Version: 184.108.40.2067630 (R2019a) Update 7