Consolidator bug with custom function handle when no replicates exist
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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: 9.6.0.1307630 (R2019a) Update 7
0 commentaires
Réponses (1)
Sai Sri Pathuri
le 8 Mai 2020
Consolidator is one of the several submissions in MATLAB File Exchange on MATLAB Central which is a forum for our product users to interact, exchange information and knowledge, without MathWorks' involvement. Feel free to contact the author of this submission directly for specific questions about the implementation
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!