tic,avg_dup(X);toc
Elapsed time is 58.442939 seconds.
tic,consolidator(X);toc
Elapsed time is 0.609666 seconds.
And it is not terribly useful, since it
1. Looks for exact replicates, with no capability for a tolerance.
2. Allows the capability to average only. If you want to compute instead the sum, or max, min, harmonic mean, median, geometric mean, standard deviation, etc., you are out of luck.
There is no H1 line, merely a statement of the author's name and e-mail address. That means the lookfor tool is disabled when you forget what the name of this tool is next year.
I'd suggest a tool that offers everything this does and far more, allowing you to compute any aggregative measure, has better help, an H1 line, and is seriously faster.
In addition, you might revise your help section, so that it mimics ML standards (H1 line, used by LOOKFOR, a SEE ALSO line). Take a look at the help of any basic ML function for some inspiration.
Incredibly slow.
X = round(rand(1e6,1)*10000);
tic,avg_dup(X);toc
Elapsed time is 58.442939 seconds.
tic,consolidator(X);toc
Elapsed time is 0.609666 seconds.
And it is not terribly useful, since it
1. Looks for exact replicates, with no capability for a tolerance.
2. Allows the capability to average only. If you want to compute instead the sum, or max, min, harmonic mean, median, geometric mean, standard deviation, etc., you are out of luck.
There is no H1 line, merely a statement of the author's name and e-mail address. That means the lookfor tool is disabled when you forget what the name of this tool is next year.
I'd suggest a tool that offers everything this does and far more, allowing you to compute any aggregative measure, has better help, an H1 line, and is seriously faster.
http://www.mathworks.com/matlabcentral/fileexchange/8354-consolidator
This might be useful to some. However, you should a look at accumarray:
[u,i,j] = unique(A(:,1)) ;
A_avg_dup = [j, accumarray(j,A(:,2),[],@mean)] ;
In addition, you might revise your help section, so that it mimics ML standards (H1 line, used by LOOKFOR, a SEE ALSO line). Take a look at the help of any basic ML function for some inspiration.
Comment only