bug1not
Banned
how to display content of xls file in "static text" in GUI at specific day and time
hi guyz..
just want to ask how will i display the content of a cell from xls file in "static text" in GUI at specific day and time?
i want to make a program that will detect the current day,the current time, and post the contents of a particular cell coming from an xls file to a a "static text"..
this is the xls file..
here are the codes i made..
the code above detects if it is 7:30AM and post the contents of the cell (2,2) in the "static text"..
however,when it is already 9:00AM,the contents of the cell (3,2) do not appear in the "static text"..
i think the problem is that the code above detects only the time when this program was ran..
NOTES:
im using GUIDE and the TAG 'subject' is a "static text"..
i only posted the first two "time" to make the codes short..
anyone here knows how will i modify the codes above "so that it will detect the current time" as well as "how the program will replace the contents posted in the "static text" when it reaches the next time? (stated in the variable "tym")
thanks a lot for the help..
bug1not
hi guyz..
just want to ask how will i display the content of a cell from xls file in "static text" in GUI at specific day and time?
i want to make a program that will detect the current day,the current time, and post the contents of a particular cell coming from an xls file to a a "static text"..
this is the xls file..
Code:
http://www.mediafire.com/?j6kmx0d9i1vx90i
here are the codes i made..
Code:
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
the code above detects if it is 7:30AM and post the contents of the cell (2,2) in the "static text"..
however,when it is already 9:00AM,the contents of the cell (3,2) do not appear in the "static text"..
i think the problem is that the code above detects only the time when this program was ran..
NOTES:
im using GUIDE and the TAG 'subject' is a "static text"..
i only posted the first two "time" to make the codes short..
anyone here knows how will i modify the codes above "so that it will detect the current time" as well as "how the program will replace the contents posted in the "static text" when it reaches the next time? (stated in the variable "tym")
thanks a lot for the help..
bug1not