Pembuatan Database Mahasiswa menggunakan MATLAB


Berikut ini merupakan contoh pemrograman GUI Matlab R2015b untuk pembuatan database mahasiswa. Sistem yang dirancang meliputi Form Registrasi Mahasiswa, Form Status Mahasiswa, dan Form Database Mahasiswa. Data mahasiswa disimpan dalam bentuk tabel dengan ekstensi .mat.

Langkah-langkah registrasi dan visualisasi database mahasiswa adalah sebagai berikut:
1. Membuka tampilan menu awal
Pada menu ini terdapat beberapa tombol untuk menuju ke sub menu lain di antaranya adalah Form Registrasi, Form Status, Form Database, dan Sub menu keluar

2. Membuka menu Registrasi untuk meng-inputkan data mahasiswa
Pada form ini disajikan data-data yang harus diisi di antaranya adalah Nomor Induk Mahasiswa (NIM), Nama, Jenis Kelamin, Tempat dan Tanggal Lahir (TTL), Alamat, Tahun Masuk, dan Foto.

2.1. Menginputkan data mahasiswa pada kolom yang sudah disediakan

2.2. Mengunggah foto mahasiswa dengan cara menekan tombol Browse Foto

sehingga tampilan form registrasi menjadi

2.3. Mendaftarkan data mahasiswa dengan cara menekan tombol Daftar
sehingga diperoleh tampilan seperti pada gambar berikut

3. Membuka menu Status untuk mengecek/mencari data mahasiswa
Pada form ini disajikan kolom untuk mengisi Nomor Induk Mahasiswa yang ingin dicari

3.1. Mengisikan Nomor Induk Mahasiswa pada kolom Cari NIM

3.2. Mencari data mahasiswa dengan cara menekan tombol Cari NIM
sehingga diperoleh tampilan seperti pada gambar berikut

Data dan foto yang diperoleh sesuai dengan data mahasiswa yang sebelumnya telah diisikan pada form Registrasi

4. Membuka menu Database untuk melihat data mahasiswa secara keseluruhan
Pada form ini disajikan data mahasiswa secara keseluruhan yang telah diinputkan sebelumnya pada form Registrasi

Foto mahasiswa secara keseluruhan dapat dilihat dengan cara menekan tombol Foto

sehingga diperoleh tampilan sebagai berikut

4.1. Mengurutkan data mahasiswa berdasarkan NIM

Foto-foto mahasiswa setelah NIM diurutkan

4.2. Mengurutkan data mahasiswa berdasarkan Nama

Foto-foto mahasiswa setelah Nama diurutkan

4.3. Melihat data mahasiswa per angkatan

Foto-foto mahasiswa angkatan 2011

4.4. Melihat data mahasiswa laki-laki

Foto-foto mahasiswa laki-laki

4.5. Melihat data mahasiswa perempuan

Foto-foto mahasiswa perempuan

Source code GUI Matlab untuk membuat database mahasiswa adalah sebagai berikut:
1. Menu Awal

function varargout = Database_Mahasiswa(varargin)
% DATABASE_MAHASISWA MATLAB code for Database_Mahasiswa.fig
%      DATABASE_MAHASISWA, by itself, creates a new DATABASE_MAHASISWA or raises the existing
%      singleton*.
%
%      H = DATABASE_MAHASISWA returns the handle to a new DATABASE_MAHASISWA or the handle to
%      the existing singleton*.
%
%      DATABASE_MAHASISWA('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DATABASE_MAHASISWA.M with the given input arguments.
%
%      DATABASE_MAHASISWA('Property','Value',...) creates a new DATABASE_MAHASISWA or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Database_Mahasiswa_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Database_Mahasiswa_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 Database_Mahasiswa

% Last Modified by GUIDE v2.5 06-Dec-2016 16:22:24

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @Database_Mahasiswa_OpeningFcn, ...
    'gui_OutputFcn',  @Database_Mahasiswa_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 Database_Mahasiswa is made visible.
function Database_Mahasiswa_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 Database_Mahasiswa (see VARARGIN)

% Choose default command line output for Database_Mahasiswa
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);
movegui(hObject,'center');

% UIWAIT makes Database_Mahasiswa wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Database_Mahasiswa_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)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
close;
guidata(Registrasi);

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

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

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


% --- Executes during object creation, after setting all properties.
function pushbutton1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
buttonIm = imread('registration.png');
buttonIm = imresize(buttonIm,.55);
set(hObject,'cdata',buttonIm,'string', '');


% --- Executes during object creation, after setting all properties.
function pushbutton2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
buttonIm = imread('status.png');
buttonIm = imresize(buttonIm,.55);
set(hObject,'cdata',buttonIm,'string', '');


% --- Executes during object creation, after setting all properties.
function pushbutton3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
buttonIm = imread('database.png');
buttonIm = imresize(buttonIm,.55);
set(hObject,'cdata',buttonIm,'string', '');


% --- Executes during object creation, after setting all properties.
function pushbutton4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
buttonIm = imread('close.png');
buttonIm = imresize(buttonIm,.55);
set(hObject,'cdata',buttonIm,'string', '');

2. Menu Registrasi

function varargout = Registrasi(varargin)
% REGISTRASI MATLAB code for Registrasi.fig
%      REGISTRASI, by itself, creates a new REGISTRASI or raises the existing
%      singleton*.
%
%      H = REGISTRASI returns the handle to a new REGISTRASI or the handle to
%      the existing singleton*.
%
%      REGISTRASI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in REGISTRASI.M with the given input arguments.
%
%      REGISTRASI('Property','Value',...) creates a new REGISTRASI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Registrasi_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Registrasi_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 Registrasi

% Last Modified by GUIDE v2.5 05-Dec-2016 22:42:33

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @Registrasi_OpeningFcn, ...
    'gui_OutputFcn',  @Registrasi_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 Registrasi is made visible.
function Registrasi_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 Registrasi (see VARARGIN)

% Choose default command line output for Registrasi
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);
movegui(hObject,'center');
warning off all;

% UIWAIT makes Registrasi wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Registrasi_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 edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (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 edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double


% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (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 button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton1
set(hObject,'Value',1)
set(handles.radiobutton2,'Value',0)

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

% Hint: get(hObject,'Value') returns toggle state of radiobutton2
set(hObject,'Value',1)
set(handles.radiobutton1,'Value',0)


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

% A = cell(1,8);
% Database_All = cell2table(A);
% Database_All.Properties.VariableNames{1} = 'No';
% Database_All.Properties.VariableNames{2} = 'NIM';
% Database_All.Properties.VariableNames{3} = 'Nama';
% Database_All.Properties.VariableNames{4} = 'Jenis_Kelamin';
% Database_All.Properties.VariableNames{5} = 'TTL';
% Database_All.Properties.VariableNames{6} = 'Alamat';
% Database_All.Properties.VariableNames{7} = 'Tahun_Masuk';
% Database_All.Properties.VariableNames{8} = 'Foto';

try
    load Database_All
    [no1,~] = size(Database_All.No{1,1});
    if no1 == 0
        no = 1;
    else
        [no,~] = size(Database_All.No);
        no = no+1;
    end
    
    nim = get(handles.edit1,'String');
    nama = get(handles.edit2,'String');
    laki2 = get(handles.radiobutton1,'Value');
    perempuan = get(handles.radiobutton2,'Value');
    if laki2 == 1
        jenis_kel = 'Laki-laki';
    elseif perempuan == 1
        jenis_kel = 'Perempuan';
    end
    ttl = get(handles.edit3,'String');
    alamat = get(handles.edit4,'String');
    tahun = get(handles.popupmenu1,'Value');
    switch tahun
        case 1
            tahun_masuk = '2011';
        case 2
            tahun_masuk = '2012';
        case 3
            tahun_masuk = '2013';
        case 4
            tahun_masuk = '2014';
        case 5
            tahun_masuk = '2015';
        case 6
            tahun_masuk = '2016';
        case 7
            tahun_masuk = '2017';
        case 8
            tahun_masuk = '2018';
        case 9
            tahun_masuk = '2019';
        case 10
            tahun_masuk = '2020';
    end
    
    if isempty(nim)
        warndlg('NIM tidak boleh kosong','Warning');
    elseif isempty(nama)
        warndlg('Nama tidak boleh kosong','Warning');
    else
        Database_All.No{no,1} = no;
        Database_All.Nama{no,1} = nama;
        Database_All.NIM{no,1} = nim;
        Database_All.Jenis_Kelamin{no,1} = jenis_kel;
        Database_All.TTL{no,1} = ttl;
        Database_All.Alamat{no,1} = alamat;
        Database_All.Tahun_Masuk{no,1} = tahun_masuk;
        Database_All.Foto{no,1} = handles.Img;
        
        save Database_All.mat Database_All
        msgbox(strcat(['Data Mahasiswa No. ',num2str(no),' berhasil disimpan']),'Message')
    end
catch
    warndlg('Foto tidak boleh kosong','Message')
end

% --- Executes on button press in pushbutton3.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.edit1,'String','')
set(handles.edit2,'String','')
set(handles.edit3,'String','')
set(handles.edit4,'String','')

set(handles.radiobutton1,'Value',1)
set(handles.radiobutton2,'Value',0)

set(handles.popupmenu1,'Value',1)

axes(handles.axes1)
cla reset
set(gca,'XTick',[])
set(gca,'YTick',[])

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

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
try
    [filename,pathname] = uigetfile({'*.jpg'});
    
    if ~isequal(filename,0)
        Img = imread(fullfile(pathname,filename));
        axes(handles.axes1)
        cla reset
        set(gca,'XTick',[])
        set(gca,'YTick',[])
        imshow(Img);
    else
        return
    end
    
    handles.Img = Img;
    guidata(hObject,handles)
catch
    warndlg('File harus berformat foto digital','Warning')
end

3. Menu Status

function varargout = Status(varargin)
% STATUS MATLAB code for Status.fig
%      STATUS, by itself, creates a new STATUS or raises the existing
%      singleton*.
%
%      H = STATUS returns the handle to a new STATUS or the handle to
%      the existing singleton*.
%
%      STATUS('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in STATUS.M with the given input arguments.
%
%      STATUS('Property','Value',...) creates a new STATUS or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Status_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Status_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 Status

% Last Modified by GUIDE v2.5 16-Nov-2016 20:00:18

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @Status_OpeningFcn, ...
    'gui_OutputFcn',  @Status_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 Status is made visible.
function Status_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 Status (see VARARGIN)

% Choose default command line output for Status
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);
movegui(hObject,'center');

% UIWAIT makes Status wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Status_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 edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (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 button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
try
    load Database_All
    nim = Database_All.NIM;
    
    no_search = get(handles.edit1,'String');
    no_res = strcmpi(nim,no_search);
    
    [a,~] = find(no_res);
    nama = Database_All.Nama{a,1};
    jenis_kel = Database_All.Jenis_Kelamin{a,1};
    ttl = Database_All.TTL{a,1};
    alamat = Database_All.Alamat{a,1};
    tahun_masuk = Database_All.Tahun_Masuk{a,1};
    foto = Database_All.Foto{a,1};
    
    set(handles.edit2,'String',nama)
    set(handles.edit2,'Enable','inactive')
    set(handles.edit3,'String',jenis_kel)
    set(handles.edit3,'Enable','inactive')
    set(handles.edit4,'String',ttl)
    set(handles.edit4,'Enable','inactive')
    set(handles.edit5,'String',alamat)
    set(handles.edit5,'Enable','inactive')
    set(handles.edit6,'String',tahun_masuk)
    set(handles.edit6,'Enable','inactive')
    axes(handles.axes1)
    imshow(foto);
    
catch
    set(handles.edit2,'String','')
    set(handles.edit2,'Enable','off')
    set(handles.edit3,'String','')
    set(handles.edit3,'Enable','off')
    set(handles.edit4,'String','')
    set(handles.edit4,'Enable','off')
    set(handles.edit5,'String','')
    set(handles.edit5,'Enable','off')
    set(handles.edit6,'String','')
    set(handles.edit6,'Enable','off')
    axes(handles.axes1)
    cla reset
    set(gca,'XTick',[])
    set(gca,'YTick',[])
    warndlg('NIM Mahasiswa Tidak Ditemukan','Warning');
end

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.edit1,'String','')
set(handles.edit2,'String','')
set(handles.edit3,'String','')
set(handles.edit4,'String','')
set(handles.edit5,'String','')
set(handles.edit6,'String','')

axes(handles.axes1)
cla reset
set(gca,'XTick',[])
set(gca,'YTick',[])

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


function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit5_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit6_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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

4. Menu Database

function varargout = Database(varargin)
% DATABASE MATLAB code for Database.fig
%      DATABASE, by itself, creates a new DATABASE or raises the existing
%      singleton*.
%
%      H = DATABASE returns the handle to a new DATABASE or the handle to
%      the existing singleton*.
%
%      DATABASE('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DATABASE.M with the given input arguments.
%
%      DATABASE('Property','Value',...) creates a new DATABASE or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Database_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Database_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 Database

% Last Modified by GUIDE v2.5 06-Dec-2016 16:04:05

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @Database_OpeningFcn, ...
    'gui_OutputFcn',  @Database_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 Database is made visible.
function Database_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 Database (see VARARGIN)

% Choose default command line output for Database
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);
movegui(hObject,'center');

% UIWAIT makes Database wait for user response (see UIRESUME)
% uiwait(handles.figure1);
load Database_All
[row,~] = size(Database_All);
data2 = cell(row,6);
for n = 1:row
    data2{n,1} = Database_All.NIM{n};
    data2{n,2} = Database_All.Nama{n};
    data2{n,3} = Database_All.Jenis_Kelamin{n};
    data2{n,4} = Database_All.Alamat{n};
    data2{n,5} = Database_All.TTL{n};
    data2{n,6} = Database_All.Tahun_Masuk{n};
end
set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])

handles.data2 = data2;
guidata(hObject,handles)

% --- Outputs from this function are returned to the command line.
function varargout = Database_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)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

close;
guidata(Database_Mahasiswa);


% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (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 popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1

set(handles.popupmenu2,'Value',1)
set(handles.popupmenu3,'Value',1)
set(handles.popupmenu4,'Value',1)

load Database_All
val = get(hObject,'Value');
switch val
    case 1
        Database_All = sortrows(Database_All,'NIM','ascend');
    case 2
        Database_All = sortrows(Database_All,'NIM','descend');
end

[row,~] = size(Database_All);
data2 = cell(row,6);
for n = 1:row
    data2{n,1} = Database_All.NIM{n};
    data2{n,2} = Database_All.Nama{n};
    data2{n,3} = Database_All.Jenis_Kelamin{n};
    data2{n,4} = Database_All.Alamat{n};
    data2{n,5} = Database_All.TTL{n};
    data2{n,6} = Database_All.Tahun_Masuk{n};
end
set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])

a = table(data2);
save a.mat a
handles.data2 = data2;
guidata(hObject,handles)

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

% Hint: popupmenu 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 popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (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 popupmenu2 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu2

set(handles.popupmenu1,'Value',1)
set(handles.popupmenu3,'Value',1)
set(handles.popupmenu4,'Value',1)

load Database_All
val = get(hObject,'Value');
switch val
    case 1
        Database_All = sortrows(Database_All,'Nama','ascend');
    case 2
        Database_All = sortrows(Database_All,'Nama','descend');
end

[row,~] = size(Database_All);
data2 = cell(row,6);
for n = 1:row
    data2{n,1} = Database_All.NIM{n};
    data2{n,2} = Database_All.Nama{n};
    data2{n,3} = Database_All.Jenis_Kelamin{n};
    data2{n,4} = Database_All.Alamat{n};
    data2{n,5} = Database_All.TTL{n};
    data2{n,6} = Database_All.Tahun_Masuk{n};
end
set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
handles.data2 = data2;
guidata(hObject,handles)

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

% Hint: popupmenu 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 popupmenu3.
function popupmenu3_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu3 (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 popupmenu3 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu3

set(handles.popupmenu1,'Value',1)
set(handles.popupmenu2,'Value',1)
set(handles.popupmenu4,'Value',1)

load Database_All
val = get(hObject,'Value');
switch val
    case 1
        [row,~] = size(Database_All);
        data2 = cell(row,6);
        for n = 1:row
            data2{n,1} = Database_All.NIM{n};
            data2{n,2} = Database_All.Nama{n};
            data2{n,3} = Database_All.Jenis_Kelamin{n};
            data2{n,4} = Database_All.Alamat{n};
            data2{n,5} = Database_All.TTL{n};
            data2{n,6} = Database_All.Tahun_Masuk{n};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 2
        angkatan = '2011';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 3
        angkatan = '2012';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 4
        angkatan = '2013';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 5
        angkatan = '2014';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 6
        angkatan = '2015';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 7
        angkatan = '2016';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 8
        angkatan = '2017';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 9
        angkatan = '2018';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 10
        angkatan = '2019';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 11
        angkatan = '2020';
        [r,~] = find(strcmpi(Database_All.Tahun_Masuk,angkatan));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
end

handles.data2 = data2;
guidata(hObject,handles)

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

% Hint: popupmenu 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 popupmenu4.
function popupmenu4_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (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 popupmenu4 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu4

set(handles.popupmenu1,'Value',1)
set(handles.popupmenu2,'Value',1)
set(handles.popupmenu3,'Value',1)

load Database_All
val = get(hObject,'Value');
switch val
    case 1
        [row,~] = size(Database_All);
        data2 = cell(row,6);
        for n = 1:row
            data2{n,1} = Database_All.NIM{n};
            data2{n,2} = Database_All.Nama{n};
            data2{n,3} = Database_All.Jenis_Kelamin{n};
            data2{n,4} = Database_All.Alamat{n};
            data2{n,5} = Database_All.TTL{n};
            data2{n,6} = Database_All.Tahun_Masuk{n};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 2
        jenis_kel = 'Laki-Laki';
        [r,~] = find(strcmpi(Database_All.Jenis_Kelamin,jenis_kel));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
    case 3
        jenis_kel = 'Perempuan';
        [r,~] = find(strcmpi(Database_All.Jenis_Kelamin,jenis_kel));
        data2 = cell(numel(r),6);
        for n = 1:numel(r)
            data2{n,1} = Database_All.NIM{r(n)};
            data2{n,2} = Database_All.Nama{r(n)};
            data2{n,3} = Database_All.Jenis_Kelamin{r(n)};
            data2{n,4} = Database_All.Alamat{r(n)};
            data2{n,5} = Database_All.TTL{r(n)};
            data2{n,6} = Database_All.Tahun_Masuk{r(n)};
        end
        set(handles.uitable1,'Data',data2,'ForegroundColor',[0 0 0])
end

handles.data2 = data2;
guidata(hObject,handles)

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

% Hint: popupmenu 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 pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
load Database_All
data2 = handles.data2;
[row,~] = size(data2);
nama = cell(row,1);
a = ceil(row/4);
figure,
for n = 1:row
    nama{n,1} = data2{n,2};
    [r,~] = find(strcmpi(Database_All.Nama,nama{n}));
    
    subplot(4,a,n)
    imshow(Database_All.Foto{r})
    title(Database_All.Nama{r})
end

Source code mengenai pemrograman di atas dapat diperoleh melalui halaman berikut ini: Source Code

Posted on December 6, 2016, in Data mining, Pengenalan Matlab and tagged , , , , , , , , , , , , , . Bookmark the permalink. 21 Comments.

  1. bisa di export ke sql ga hasil databasenya pak?

    • Pak Fakhrurrozi Basyid
      matlab terintegrasi dengan beberapa software salah satu di antaranya adalah mysql
      butuh koding khusus dan berbeda jika membuat database menggunakan matlab & mysql

  2. Mas Adi, cara set default form di matlab yg akan keluar pertama kali bagaimana ya caranya ? Misalnya saya launch .exe terus yg muncul pertama kali form 1 bukan form 2. Thx

  3. mas cara menjalankannya di matlab gimana ya source codenya?

  4. mas kok databasenya tdk bisa dilihat?

  5. Mas, bagaimana cara membuka database berekstensi .mat?
    Atau adakah tutorial cara membuat dan cara membuka database berekstensi .mat?
    Terimakasih

  6. sudah mas, sudah load Database_All.mat setelah itu muncul
    Warning: Variable ‘Database_All’ originally saved as a table cannot be instantiated as an
    object and will be read in as a uint32. Bagaimana?

  7. sore mas, mau nanya, untuk database nya memakai databse apa ya ? terima kasih

  8. Assalamu’alaikum bg, mau nanya kalo “Database_All.mat” itu dibuat manual kolom dan barisnya, atau langsung otomatis menyesuaikan dengan daftar yang akan kita inputkan ?. Terimkasih.

  9. assalamualaikum mas, cara buat databasenya bagaimana ya? soalnya ketika saya jalankan dia tidak menemukan file Database.All nya tersebut. Terimakasih sebelumnya 🙂

  10. atau kalau mas berkenan, boleh tidak saya minta file Database_All nya tersebut di email saya? saya sidang sebentar lagi mas, dan masih pusing dengan database matlabnya hehe :”D

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: