0% encontró este documento útil (0 votos)
23 vistas8 páginas

No 2

El documento describe un programa en MATLAB que simula la conversión de calificaciones numéricas a letras y proporciona comentarios sobre el rendimiento del estudiante. Utiliza una interfaz gráfica de usuario (GUI) donde los estudiantes pueden ingresar su nombre, NIM y calificación, y al presionar un botón se muestra la calificación en letras y una descripción del resultado. El programa también incluye botones para limpiar los campos y cerrar la aplicación.

Cargado por

Zuhra Apriyani
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
23 vistas8 páginas

No 2

El documento describe un programa en MATLAB que simula la conversión de calificaciones numéricas a letras y proporciona comentarios sobre el rendimiento del estudiante. Utiliza una interfaz gráfica de usuario (GUI) donde los estudiantes pueden ingresar su nombre, NIM y calificación, y al presionar un botón se muestra la calificación en letras y una descripción del resultado. El programa también incluye botones para limpiar los campos y cerrar la aplicación.

Cargado por

Zuhra Apriyani
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd

2.

Buatlah simulasi nilai angka dengan menggunakan GUI MATLAB untuk mahasiswa
pendidikan fisika :

Gunakan pedoman : terdapat nama dan NIM, angka dan huruf serta keterangan

Nilai Angka Nilai Huruf Keterangan


0≤nilai≤40 E Tidak lulus
45≤nilai≤54 D Tidak lulus
55≤nilai≤64 C Perbaikan
65≤nilai≤79 B Lulus
80≤nilai≤100 A Lulus

Jawab :

a. Soucre code program


Pushbutton 1

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

% Last Modified by GUIDE v2.5 15-Dec-2009 [Link]

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @nurulhikmah2_OpeningFcn, ...
'gui_OutputFcn', @nurulhikmah2_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 nurulhikmah2 is made visible.


function nurulhikmah2_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 nurulhikmah2 (see VARARGIN)

% Choose default command line output for nurulhikmah2


[Link] = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes nurulhikmah2 wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = nurulhikmah2_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} = [Link];

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 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)
%menampilkan huruf ketika menekan hitung
angka=str2num(get(handles.edit3,'string'));
if angka<=44
set(handles.edit4,'string','E');
elseif angka<=54
set(handles.edit4,'string','D');
elseif angka<=64
set(handles.edit4,'string','C');
elseif angka<=79
set(handles.edit4,'string','B');
elseif angka<=100
set(handles.edit4,'string','A');
end
%menampilkan kterangan ketika menekan hitung
angka=str2num(get(handles.edit3,'string'));
if angka<=44
set(handles.edit5,'string','TIDAK LULUS');
elseif angka<=54
set(handles.edit5,'string','TIDAK LULUS');
elseif angka<=64
set(handles.edit5,'string','PERBAIKAN');
elseif angka<=79
set(handles.edit5,'string','LULUS');
elseif angka<=100
set(handles.edit5,'string','LULUS');
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 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 edit6_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
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (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 edit5 as text


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

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


function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (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 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','')%mengosongkan string pada edit1 1
set(handles.edit2,'string','')%mengosongkan string pada edit1 2
set(handles.edit3,'string','')%mengosongkan string pada edit1 3
set(handles.edit4,'string','')%mengosongkan string pada edit1 4
set(handles.edit5,'string','')%mengosongkan string pada edit1 5

% --- 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
b. Capture
Jika memasukan angka 100 maka akan keluar huruf “A” dan keterangan ‘’Lulus’’,
begitu pun jika memasukan angka dari 0 sampai 100 akan keluar huruf dan
keterangan yang sesuai ketentuan yang dibuat . tetapi, jika kita menulis angka kurang
dari 0 dan lebih dari 100 maka tidak keluar huruf dan keterangannya

También podría gustarte