Code covered by the BSD License  

Highlights from
MATLAB Contest Statistics

image thumbnail
from MATLAB Contest Statistics by Matthew Simoneau
The code used to generate the "Statistics" page for the MATLABĀ® Contest.

dailyActivity(p)
function dailyActivity(p)

% Highlighting all the entries submitted on each day in red shows shows how
% the overall progression down and to the left.  A black circle indicates
% the leader at the end of each day.

clf
orders = 2;
alldays = [p.date];
allscores = [p.score];
firstDay = floor(min([p.date]));
isLeader = [p.isLeader];

mi = min([p(isLeader).rawScore]);
ma = max([p(isLeader).rawScore]);
y = normalize([p.rawScore],orders,mi,ma);
x = [p.cpu_time];
for n = 1:8
    t1 = firstDay-1+n;
    t2 = t1+1;
    day1 = find(alldays>t1 & alldays<t2);
    if isempty(day1)
        break
    end
    subplot(2,4,n)
    line(x,y, ...
        'LineStyle','none','Marker','x','MarkerSize',3,'Color',[.8 .8 1])
    line(x(day1),y(day1), ...
        'LineStyle','none','Marker','.','Color','red')
    % Find the current leader for the day
    dayScores = [p(day1).score];
    dayScores(dayScores<0) = inf;
    minDay = min(dayScores);
    leader = find(allscores==min(dayScores));
    line(x(leader),y(leader),'Marker','o','Color','black','LineWidth',2)

    set(gca,'FontSize',8)
    set(gca,'Box','on')
    set(gca,'XColor',0.75*[1 1 1],'XGrid','off','GridLineStyle','-')
    set(gca,'YColor',0.75*[1 1 1],'YGrid','off')
    set(gca,'XTick',[],'YTick',[])
    set(gcf,'Color','white')
    xlabel('cpu time'); ylabel('results (log scale)')
    set(get(gca,'XLabel'),'Color','black')
    set(get(gca,'YLabel'),'Color','black')
    title(datestr(t1,'ddd'))
    warning off;
    set(gca,'YScale','log'); 
    set(gca,'xlim',[0 max(x(isLeader))])
    set(gca,'ylim',[.9 10^orders*1.1])
    warning on
end

Contact us at files@mathworks.com