tym=[0730 0900 1030 1200 1330 1500 1630 1800 1930 2100 2200 0700];
[num_aldaw aldaw]=weekday(floor(now));
[num_klase klase]=xlsread('class.xls'); %contains the schedule for MON up to SAT
time = datestr(now,'HHMM');
timenum = str2double(time);
if num_aldaw==2 || num_aldaw==4 %for mon and wed
if timenum>=tym(1)&timenum<tym(2) %detects if current time is >=7:30AM and <9:00AM
subject=klase{2,2};
if isempty(subject)
subject=('NO CLASS!');
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject); %post the words "NO CLASS!" in the "static text"
else
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject); %post the contents of the cell (2,2) in the "static text"
end
end
if timenum>=tym(2)&timenum<tym(3) %detects if current time is >=9:00AM and <10:30AM
subject=klase{3,2};
if isempty(subject)
subject= ('NO CLASS!');
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject); %post the words "NO CLASS!" in the "static text"
else
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject); %post the contents of the cell (3,2) in the "static text"
end
end
end
if num_aldaw==3 || num_aldaw==5 % for tues and thurs
if timenum>=tym(1)&timenum<tym(2)
subject=klase{2,3};
if isempty(subject)
subject=('NO CLASS!');
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject);
else
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject);
end
end
if timenum>=tym(2)&timenum<tym(3)
subject=klase{3,3};
if isempty(subject)
subject= ('NO CLASS!');
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject);
else
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject);
end
end
end
if num_aldaw==6 || num_aldaw==7 % for fri and sat
if timenum>=tym(1)&timenum<tym(2)
subject=klase{2,6};
if isempty(subject)
subject=('NO CLASS!');
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject);
else
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject);
end
end
if timenum>=tym(2)&timenum<tym(3)
subject=klase{3,6};
if isempty(subject)
subject= ('NO CLASS!');
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject);
else
HH = findobj(gcf,'Tag','subject');
set(HH,'String',subject);
end
end
end