image thumbnail
from Clock Bell by Krishna Lalith
Place the coins on turn basis, on the board to complete &/or to block to gain different medals.

TopScore(NewName,NewScore,Time,NewMedal)
function TopScore(NewName,NewScore,Time,NewMedal)

%Appending the new score
NewDate=clock;
NewDate=sprintf('%02d/%02d/%04d',NewDate(3),NewDate(2),NewDate(1));
NewTime=sprintf('%02.0f:%02.0f',floor(Time/60),mod(Time,60));

fid = fopen('TopScores.mat', 'r');
TopList = textscan(fid,'%s','delimiter','\n');
TopList=char(TopList{1});
fclose(fid);

TopList(11,:)=sprintf('%1d %7s    %10s    %3d   %5s    %1d   ',0,char(NewName),NewDate,NewScore,NewTime,NewMedal);

%Sorting all the entries based on Score
for ii=2:size(TopList,1),
    for jj=ii+1:size(TopList,1),
        if str2num(TopList(ii,27:30))<str2num(TopList(jj,27:30)),
            temp=TopList(ii,:);
            TopList(ii,:)=TopList(jj,:);
            TopList(jj,:)=temp;
        end
    end
end

TopList(1,:)='#   NAME        DATE      SCORE  TIME   MEDALS';
fid = fopen('TopScores.mat', 'w');
for ii=1:10,%always 10 lines (1 title + 9 entries)
    if ii~=1,
        TopList(ii,1)=num2str(ii-1);
    end
    fprintf(fid,'%s\n',TopList(ii,:));
end
fclose(fid); 

TopList(11,:)=[];
[cupdata cupmap]=imread('Cup.jpg');
 MsgHand=msgbox(TopList,'Top Scores','custom',cupdata,cupmap);
 scrsz = get(0,'ScreenSize');
 set(MsgHand,'position',[scrsz(3)/4 scrsz(3)/4 scrsz(3)/3.5 scrsz(4)/7]);
 ChildHand= get(MsgHand,'children');
 set(findobj(ChildHand,'type','text'),'fontname','courier');
 set(ChildHand(3),'position',[175    7.0000   40.0000   17.0000]);
 if ~waitforbuttonpress,  close(MsgHand); end

Contact us at files@mathworks.com