Está en la página 1de 6

TUGAS

PEMROGRAMAN DENGAN POP UP MENU



CITRA PANJATAN
1304115419
BDP A

1. Buka aplikasi MATLAB, blank guide dan buat desain seperti ini.




2. Lengkapi semua datanya. Title pada string, font size, font weight, color, etc.



3. RUN programnya. Maka akan munculan tampilan sementara seperti ini.

1. Minimize gambar, fokus pada formula. Isi semua perintah yang berfungsi untuk
mengaktifkan setiap tool.

Rumus-rumus yangdimasukkan :
1. Pop-up menu
**% --- Executes just before popupmenucitra131 is made visible.
function popupmenucitra131_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 popupmenucitra131 (see VARARGIN)

%create the data to plot
handles.peaks=peaks(35);
handles.membrane=membrane;
[x,y]=meshgrid(-8:0.5:8);
r=sqrt(x.^2+y.^2)+eps;
sinc=sin(r)./r;
handles.sinc=sinc;
handles.current_data=handles.peaks;
surf(handles.current_data);


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

% Update handles structure
guidata(hObject, handles);

**% --- 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

val=get(hbject,'value');
str=get(hobject,'string');
switch str(val)
case 'peaks' % user selects peaks
handles.current_data=handles.peaks;
case 'membrane' % user selects peaks
handles.current_data=handles.membrane;
case 'sinc' % user selects peaks
handles.current_data=handles.sinc;
end
guidata(hobject,handles);

2. Push Button
% --- 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)

% display surf plot of currently selected data
surf(handles.curreant_data);

% --- 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)

% display mesh plot of currently selected data
mesh(handles.curreant_data);

% --- 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)

% display contour plot of currently selected data
contour(handles.curreant_data);
close




Setelah semua formula lengkap,RUN kembali. Maka akan muncul tampilan seperti ini. Ini
berarti formula yang dimasukkan sudah tepat.
BERHASIl !!

También podría gustarte