Sie sind auf Seite 1von 29

MORGAN STATE UNIVERSITY

DEPARTMENT OF CIVIL ENGINEERING

SPRING 2017 CEGR 307 TEAM PROJECTS

Attendance system

Advisor (Dr. Kadir Aslan)

Group Q8

Mubarak Alnajjar

Yousef Alazmi

Saad Almutairi

1
MORGAN STATE UNIVERSITY ................................................................................................ 1
ABSTRACT: ................................................................................................................................... 3
Problem statement: ........................................................................................................................ 3
Existing methods:........................................................................................................................... 3
Proposed work:............................................................................................................................... 3
Expected outcome: ......................................................................................................................... 3
Week (02/14/2019 – 02/21/2019) .................................................................................................. 4
Code: ............................................................................................................................................... 7
Output:............................................................................................................................................ 7
Expected outcome: ......................................................................................................................... 9
Week (02/21/2019 – 02/28/2019) ................................................................................................. 10
Code: ............................................................................................................................................. 10
Output:.......................................................................................................................................... 10
Week (02/28/2019 – 03/07/2019) ................................................................................................. 12
Explanation: ................................................................................................................................. 13
CODE: .......................................................................................................................................... 13
For creating data and saving it: .................................................................................................. 13
for check attendance: ................................................................................................................... 14
OUTPUT: ..................................................................................................................................... 14
week (03/07/2019 – 03/14/2019) .................................................................................................. 15
CODE: .......................................................................................................................................... 15
OUTPUT: ..................................................................................................................................... 18
Week (03/14/2019 – 03/28/2019) ................................................................................................. 20
Code: ............................................................................................................................................. 20
Output:.......................................................................................................................................... 25
Week (03/28/2019 – 04/04/2019) ................................................................................................. 26
Conclusion: .................................................................................................................................. 29

2
ABSTRACT:

Problem statement:
The purpose of this project is to mark the attendance of the students efficiently, it makes
a system which opens the door of the class when the student enters its student ID on the system
and then it counts the attendance of the students. This system helps then to prevent the plagrism
of marking the attendance when student is absent.

Existing methods:
The existing method used in mostly school/colleges used the teachers register to mark the
attendance of the students using their name, but this method is old, time consuming and not very
efficient and it may distract the teaching process and there are a lot of problems in this method,
many students mark the attendance of other students who are absent but with using this method
no one can mark the attendance of other and this method is 100% accurate.

Proposed work:
In this project we want to build the system which is build using MATLAB tool and GUI.
The system has the data stored in it which has the name and ID numbers of all students and this
has buttons which take the ID of the student as inputs and then check the system for the data of
the system and then mark the attendance of the student and allow them to enter. The system is
build using MATLAB GUI, the GUI build has buttons and text editor to edit the ID number of
the students and then button to enter, then if the ID match with any of the existing ID of student
then it mark the attendance of the that student and show the output as they are marked and allow
them to enter the room. This system also keeps the record of the attendance of each system in its
record.

Expected outcome:
The expected result of this project is the system build using MATLAB GUI which takes
the input as student ID of the students, check the record of the student and then mark the output
of the student and then allow them to enter.

3
Introduction
Every Thursday we have a lab class of two hours. In this class we need to work for the
project by adding or editing codes. Also, Dr. Aslan our adviser sees our work and give feedback
and grade us every week depends of our work or what we did so far. Furthermore, Dr. Aslan give
us a suggestion to do next week. For all of this we need to write weekly report that show what
we did and get. The weekly report contains 1- number of the week and date. 2- The problem
3-discussion with Dr. Aslan. 4- codes 5-output/results 6-Dr. Aslan Suggestions.

 Week 1 (01/31/2019 – 02/07/2019)


In this week Dr. Aslan give us a choose to choose three subjects for our project and explain
each of them to him. Then Dr. Aslan will choose one of the topics that we find to make our
project in this topic. The first topic was about the Attendance system. In this project the student
won’t enter the class until he swipes his Student identification card. The door will open, and he
will be marked attend. It will save time for the doctor instead of passing the attendance or saying
the names. Also, it will prevent cheating that did it some student by marked his friend attend.
The second topic was about checking the driver information by scan the car plate. For example,
someone take a picture of the car plate and by an App it will show him that the owner for that car
is violent or not, of course without showing his name. Then the person who took the picture have
a chance to send a report to the police or not. This project helps the police to get or know the
violators faster. this happen by the Civilians. For the last project, it was about the car’s safety.
When the driver deviates from the road path or approached more than a meter from the vehicle in
front of him, it will give him a caution by vibration, the seat will vibrate to let him know that he
might do an accident. This project will help by saving more life and decrees the accidents,
especially for the drivers who use their phones!
Dr. Aslan choose for our group to do the attendance system project. And work for a proposal
for this project for the next week and present it to the class.

4
Week 2 (02/07/2019 – 02/14/2019)

In this week, all the class should present their project proposal. We present our project
proposal about the attendance system. Then Dr. Aslan give us feedback about the proposal if its
good or not and then grade us for this week. Also, Dr. Aslan suggest generating a random
number of the students for next week work.

5
 Week 3 (02/14/2019 – 02/21/2019)

Dr. Aslan Suggestion


 Create 50 random numbers of student ID with 8 digits

6
We use the MATLAB to randomly create matrix which has 50 columns which represent 50
students and 4 rows each with 2 digits to represent the 8-digit number and in this way, we create
8 digit number.

Code:
x=randi(50,50,4)

Output:
x=

17 10 42 17
34 45 37 8
13 5 48 18
15 3 2 7
35 28 18 45
27 39 34 5
21 16 15 47
31 9 12 20
38 17 36 3
30 11 32 18
28 26 30 37
30 46 34 40
26 32 3 28
5 6 18 35
36 20 23 45
50 3 13 3
18 26 36 16
49 22 43 3
18 50 15 10
45 41 37 37
23 25 7 37
21 45 42 44

7
11 7 7 30
7 20 30 4
16 47 19 47
37 46 41 41
40 36 26 15
35 31 25 28
1 18 44 50
43 47 18 36
47 7 23 42
39 37 49 22
3 33 3 24
19 42 49 29
36 20 10 14
37 38 34 38
12 42 30 26
14 17 34 33
34 28 19 16
24 49 32 7
32 28 41 24
12 17 1 19
9 31 5 40
42 19 49 40
39 38 33 34
47 21 12 7
6 25 21 2
10 35 7 28
5 49 14 16
25 17 13 47

8
Expected outcome:
The expected result of this project is the system build using MATLAB GUI which takes the
input as random 8 digit student ID of the students, check the record of the student and then mark
the output of the student and then allow them to enter.

9
 Week 4 (02/21/2019 – 02/28/2019)
Dr. Aslan Suggestion
 Create the 50 random students ID numbers in the M-file
 Save the numbers in Excel file

Code:
This code will first generate the random array of 50 numbers and save it in mat file. Then ask the
student about its ID. If the ID match with saved ID then it mark attendance.
x=randi(50,50,4);
% it creates 50 rows of 50 students and 4 rows each having the 2 digit
% number so the total it shows 8 digit number is each row
disp('the random variable of the student ID of 8 digit is');
XX=zeros(50,1);
for i=1:50
XX(i,1) = (x(i,1),x(i,2), x(i,3), x(i,4))
save('ID_numver.mat',XX);
end
ID = input('enter your 8 digitID number');
for i=1:50
if(ID== XX(i,1))
disp('your attendence has been marked');
else
disp('sorry wrong ID number. please enter again!!')
end
end

Output:
x=

17 10 42 17
34 45 37 8
13 5 48 18
15 3 2 7
35 28 18 45
27 39 34 5
21 16 15 47
31 9 12 20
38 17 36 3
30 11 32 18

10
28 26 30 37
30 46 34 40
26 32 3 28
5 6 18 35
36 20 23 45
50 3 13 3
18 26 36 16
49 22 43 3
18 50 15 10
45 41 37 37
23 25 7 37
21 45 42 44
11 7 7 30
7 20 30 4
16 47 19 47
37 46 41 41
40 36 26 15
35 31 25 28
1 18 44 50
43 47 18 36
47 7 23 42
39 37 49 22
3 33 3 24
19 42 49 29
36 20 10 14
37 38 34 38
12 42 30 26
14 17 34 33
34 28 19 16
24 49 32 7
32 28 41 24

11
12 17 1 19
9 31 5 40
42 19 49 40
39 38 33 34
47 21 12 7
6 25 21 2
10 35 7 28
5 49 14 16
25 17 13 47

12
Week 5 (02/28/2019 – 03/07/2019)

Dr. Aslan Suggestion


 Make the command window ask to swipe the card and check if he attend or not

Explanation:
In the MATLAB we have two files, one is for ‘randomIDs’ and other is
‘ATTENDENCE_SYSTEM’. The first code creates the random IDs of 8 digit for 50 students for
running loop for 50 times, the after creating these IDs it save it in an array, then for saving this
array to the excel file, we first add the location of the position where we want to add file and then
we create xlxs file named ‘IDs’ using the ‘xlxswrite’ function in a specified folder.
Then in the next code ‘ATTENDENCE_SYSTEM’ it ask the student to swipe the card, if it
swipe card then it takes the ID of the student and check it in excel file ‘IDs’ using the ‘xlxsread’
command and if it is present then it displays that ‘your attendance has been marked’ else it ask to
enter correct ID’

CODE:
For creating data and saving it:
disp('the random variable of the student ID of 8 digit is'); % display
the statement
ID=zeros(50,1); % initialize the ID array with 50 rows and 1 column with
all 0's
card = 0;
for i=1:50 % run the loop
ID(i,1)=randi([10000000, 99999999]) % save the random variable of 8 digit
on each row of ID variable
end
cd 'C:\Users\Ghousia PC' % change the path of the file in which you want
to save ID.

13
filename = 'IDs.xlsx'; % intialize the name of the excel file as "IDs"
xlswrite(filename,ID,1,'E1:E50'); % save the values of all IDs in a excel
file in column E from E1 to E50

for check attendance:

cd 'C:\Users\Ghousia PC' % change the path of the file in which you want
to save ID.
ID=xlsread('IDs',1,'E1:E50');
card = input('please swipe your card'); % ask user to enter the ID number
and save it as ii
if (card==1)
c=0;
ii=input('enter ID card number');
for i=1:50 % run the loop in the IDs
if(ii== ID(i,1)) % check if the entered ID ii match any of the saved ID
c=c+1;
end
end
if (c>0)
disp('your attendence has been marked');% if saved then display this
message
else
disp('invalid ID'); % if not match then display the message.
end
else
disp('PLEASE swipe the card');
end

OUTPUT:
The output of this lab is excel file.
>> ATTENDENCE_SYSTEM
please swipe your card1
enter ID card number31595727
your attendance has been marked

14
week 6 (03/07/2019 – 03/14/2019)
Dr. Aslan Suggestion
 Make a popup menu for the attendance system

CODE:
function varargout = AttendenceSystem(varargin)
% ATTENDENCESYSTEM MATLAB code for AttendenceSystem.fig
% ATTENDENCESYSTEM, by itself, creates a new ATTENDENCESYSTEM or raises
the existing
% singleton*.
%
% H = ATTENDENCESYSTEM returns the handle to a new ATTENDENCESYSTEM or
the handle to
% the existing singleton*.
%
% ATTENDENCESYSTEM('CALLBACK',hObject,eventData,handles,...) calls the
local
% function named CALLBACK in ATTENDENCESYSTEM.M with the given input
arguments.
%
% ATTENDENCESYSTEM('Property','Value',...) creates a new
ATTENDENCESYSTEM or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before AttendenceSystem_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to AttendenceSystem_OpeningFcn via
varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help AttendenceSystem

% Last Modified by GUIDE v2.5 29-Mar-2019 00:28:16

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @AttendenceSystem_OpeningFcn, ...
'gui_OutputFcn', @AttendenceSystem_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);

15
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before AttendenceSystem is made visible.


function AttendenceSystem_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to AttendenceSystem (see VARARGIN)

% Choose default command line output for AttendenceSystem


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);
imshow('Figure1.jpg')
set(handles.Status,'string', 'Please Enter Student ID and Press Mark
Attendence, Thank you');
% UIWAIT makes AttendenceSystem wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = AttendenceSystem_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;

function StudentId_Callback(hObject, eventdata, handles)


% hObject handle to StudentId (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of StudentId as text


% str2double(get(hObject,'String')) returns contents of StudentId as a
double

16
% --- Executes during object creation, after setting all properties.
function StudentId_CreateFcn(hObject, eventdata, handles)
% hObject handle to StudentId (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in StudentsAttending.


function StudentsAttending_Callback(hObject, eventdata, handles)
% hObject handle to StudentsAttending (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns StudentsAttending


contents as cell array
% contents{get(hObject,'Value')} returns selected item from
StudentsAttending

% --- Executes during object creation, after setting all properties.


function StudentsAttending_CreateFcn(hObject, eventdata, handles)
% hObject handle to StudentsAttending (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in CheckAttendence.


function CheckAttendence_Callback(hObject, eventdata, handles)
% hObject handle to CheckAttendence (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

ID = str2double(get(handles.StudentId,'string'));
check = checkStudent(ID);
if (check == 1)
set(handles.Status,'string', 'Student Attendence is Marked, Thank
you');
else
set(handles.Status,'string', 'Sorry !!! ,Student ID does not Exists.,
Thank you');
end

17
function flag = checkStudent(ID)
% This function checks if the input ID exists in the list of registered
% student IDs

load IDnumber.txt

flag = 0;
for i = 1: length(IDnumber)
if IDnumber(i) == ID
flag = 1;
break;
end
end

OUTPUT:
The output of this lab is excel file.
>> ATTENDENCE_SYSTEM

18
19
Week 7 (03/14/2019 – 03/28/2019)
Dr. Aslan Suggestion
 Make 2 check list: one that show the correct ID numbers that is one of the 50
ID’s numbers.
 the other one for the incorrect numbers that entered if its more than 8 digits of
less or not between the 50 ID’s number.

Code:
function varargout = AttendenceSystem2(varargin)
% ATTENDENCESYSTEM2 MATLAB code for AttendenceSystem2.fig
% ATTENDENCESYSTEM2, by itself, creates a new ATTENDENCESYSTEM2 or
raises the existing
% singleton*.
%
% H = ATTENDENCESYSTEM2 returns the handle to a new ATTENDENCESYSTEM2 or
the handle to
% the existing singleton*.
%
% ATTENDENCESYSTEM2('CALLBACK',hObject,eventData,handles,...) calls the
local
% function named CALLBACK in ATTENDENCESYSTEM2.M with the given input
arguments.
%
% ATTENDENCESYSTEM2('Property','Value',...) creates a new
ATTENDENCESYSTEM2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before AttendenceSystem2_OpeningFcn gets called.
An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to AttendenceSystem2_OpeningFcn via
varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help AttendenceSystem2

% Last Modified by GUIDE v2.5 04-Apr-2019 21:23:47

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @AttendenceSystem2_OpeningFcn, ...
'gui_OutputFcn', @AttendenceSystem2_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})

20
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before AttendenceSystem2 is made visible.


function AttendenceSystem2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to AttendenceSystem2 (see VARARGIN)

% Choose default command line output for AttendenceSystem2


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);
imshow('Figure1.jpg') % This line is to show the figure in place of graph
% This line prints the date on the top
% following line sets a message on the status bar when the program runs
set(handles.Status,'string', 'Please Enter Student ID and Press Mark
Attendence, Thank you');
% UIWAIT makes AttendenceSystem2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = AttendenceSystem2_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;

function StudentId_Callback(hObject, eventdata, handles)


% hObject handle to StudentId (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of StudentId as text


% str2double(get(hObject,'String')) returns contents of StudentId as a
double

21
% --- Executes during object creation, after setting all properties.
function StudentId_CreateFcn(hObject, eventdata, handles)
% hObject handle to StudentId (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in StudentsAttending.


function StudentsAttending_Callback(hObject, eventdata, handles)
% hObject handle to StudentsAttending (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns StudentsAttending


contents as cell array
% contents{get(hObject,'Value')} returns selected item from
StudentsAttending

% --- Executes during object creation, after setting all properties.


function StudentsAttending_CreateFcn(hObject, eventdata, handles)
% hObject handle to StudentsAttending (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% The code for the push button.


% --- Executes on button press in CheckAttendence.
function CheckAttendence_Callback(hObject, eventdata, handles)
% hObject handle to CheckAttendence (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Every thing the push button does is written over here

% Firstly it copies or gets the student ID from the figure using the get
% command in form of string.
% I have used string in order to get all the characters input by the user.
ID = str2double(get(handles.StudentId,'string'));

22
stringId=num2str(ID); % converts Id to a number.

if (size(stringId,2)~=8) % If ID is not an 8 digit


% Use set function to output on the status bar a string as
% following
set(handles.Status,'string', 'Input ID is not valid (ID - 8 digits),
Thank you');
else

check = checkStudent(ID); % checks if the student ID is in the list


50 of IDnumber.txt file.
if (check == 1)
selections = get(handles.listbox3,'String');
check1 = checklist(selections,stringId); % check 1 checks if the
student is in listbox 3. or if he has marked present already.
if check1 == 0 % If he is not marked present check1 will be equal
to zero
% prints the status that student is marked present now
set(handles.Status,'string', 'Student Attendence is Marked,
Thank you');
% append the answer to the list
selections = [selections ; stringId];
% update the list box with the new selection
set(handles.listbox3,'String',selections); % updated list of
IDs present is copied to listbox 3
else
set(handles.Status,'string', 'Student has already been marked
present, Thank you');
end
else
set(handles.Status,'string', 'Sorry !!! ,Student ID does not
Exists. Thank you.');
selections = get(handles.listbox4,'String');
check1 = checklist(selections,stringId);
if check1 == 0
% append the answer to the list
selections = [selections ; stringId];
% update the list box with the new selection
set(handles.listbox4,'String',selections);
end
end
end

function flag = checklist(selections,stringId)


% This function checks if the input ID is already marked present or
% not.
flag =0;
size(selections,1);
for i = 2:size(selections,1)
if selections(i,:)==stringId
flag = 1;
break;
end

23
end

function flag = checkStudent(ID)


% This function checks if the input ID exists in the list of registered
% student IDs

load IDnumber.txt
% load AttendenceSheet.txt
%
% fid = fopen('AttendenceSheet.txt'
flag = 0;
for i = 1: length(IDnumber)
if IDnumber(i) == ID
flag = 1;
break;
end
end

% --- Executes on selection change in listbox3.


function listbox3_Callback(hObject, eventdata, handles)
% hObject handle to listbox3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox3 contents


as cell array
% contents{get(hObject,'Value')} returns selected item from listbox3

% --- Executes during object creation, after setting all properties.


function listbox3_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in listbox4.


function listbox4_Callback(hObject, eventdata, handles)
% hObject handle to listbox4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox4 contents


as cell array
% contents{get(hObject,'Value')} returns selected item from listbox4

24
% --- Executes during object creation, after setting all properties.
function listbox4_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

Output:

25
Week 8 (03/28/2019 – 04/04/2019)
Dr. Aslan Suggestion
 Create an M-file for the ID numbers
 But a date for the popup menu that show todays date
 Change the colors for the ID numbers

26
Let us enter an ID that has only 7 digits.

You may observe a message that shows that input ID is not valid. An ID should be of 8-digits.
Now let us enter a valid Student-ID that has been registered for the course.

The figure shows that a valid Student ID has been entered. Therefore, a message is displayed that
Student Attendance is marked. Moreover, you will see the ID being copied to the list of student
Ids Marked present.
Let us enter the same ID once again.

27
Figure shows that a message is printed that the student ID has already been marked present for this
class.
Now, let us enter another valid Student ID.

There are two change in the interface that you can observe. One is that the message is printed that
student Attendance is Marked. The second is the list of student Ids marked present. It can be seen
that the list has been updated with another student ID.
Let us check the system with an unregistered Student ID.

28
It can be observed that the message is printed that the student id does not exists in the database.
Moreover, the list of unmatched IDs has been updated with the unmatched ID.

Conclusion:
The attendance system has been updated with the suggested revisions and the screenshots of the
system Interface has shown the proper working of the system.

29

Das könnte Ihnen auch gefallen