Beruflich Dokumente
Kultur Dokumente
Attendance system
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.
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)
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)
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
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
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
% --- 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)
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
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
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
% --- 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)
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
% 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.
23
end
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
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
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