function varargout = attendancetable_1(varargin)
% ATTENDANCETABLE_1 MATLAB code for attendancetable_1.fig
%      ATTENDANCETABLE_1, by itself, creates a new ATTENDANCETABLE_1 or raises the existing
%      singleton*.
%
%      H = ATTENDANCETABLE_1 returns the handle to a new ATTENDANCETABLE_1 or the handle to
%      the existing singleton*.
%
%      ATTENDANCETABLE_1('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in ATTENDANCETABLE_1.M with the given input arguments.
%
%      ATTENDANCETABLE_1('Property','Value',...) creates a new ATTENDANCETABLE_1 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before attendancetable_1_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to attendancetable_1_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 attendancetable_1
% Last Modified by GUIDE v2.5 18-Oct-2020 21:53:08
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @attendancetable_1_OpeningFcn, ...
                   'gui_OutputFcn',  @attendancetable_1_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
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 attendancetable_1 is made visible.
function attendancetable_1_OpeningFcn(hObject, eventdata, handles, varargin)
global p
p.MyData=[];
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes attendancetable_1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = attendancetable_1_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;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
global p
NameData = get(handles.NameField, 'string');
RegisterNumberFieldData = get(handles.RegisterNumberField, 'string');
p.MyData= [p.MyData ; [{NameData} {RegisterNumberFieldData}]];
set(handles.TableField, 'Data',p.MyData)
function NameField_Callback(hObject, eventdata, handles)
% hObject    handle to NameField (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 NameField as text
%        str2double(get(hObject,'String')) returns contents of NameField as a double
% --- Executes during object creation, after setting all properties.
function NameField_CreateFcn(hObject, eventdata, handles)
% hObject    handle to NameField (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
function RegisterNumberField_Callback(hObject, eventdata, handles)
% hObject    handle to RegisterNumberField (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 RegisterNumberField as text
%        str2double(get(hObject,'String')) returns contents of RegisterNumberField as a double
% --- Executes during object creation, after setting all properties.
function RegisterNumberField_CreateFcn(hObject, eventdata, handles)
% hObject    handle to RegisterNumberField (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 when entered data in editable cell(s) in TableField.
function TableField_CellEditCallback(hObject, eventdata, handles)
% hObject    handle to TableField (see GCBO)
% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
%	Indices: row and column indices of the cell(s) edited
%	PreviousData: previous data for the cell(s) edited
%	EditData: string(s) entered by the user
%	NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
%	Error: error string when failed to convert EditData to appropriate value for Data
% handles    structure with handles and user data (see GUIDATA)
% --- Executes on button press in PrintField.
function PrintField_Callback(hObject, eventdata, handles)
global p
PrintData = get(handles.TableField, 'string');
p.MyData= [p.MyData ; [{PrintData}]];
set(handles.TableField, 'Data',p.MyData)