1 / 13

Computer Simulation Lab

Computer Simulation Lab. “Lecture 10”. Electrical and Computer Engineering Department SUNY – New Paltz. Graphical User Interfaces (GUIs). Objectives • figure files; • application M-files; • callback functions. Basic structure of a GUI. GUIDE:

sheri
Download Presentation

Computer Simulation Lab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Simulation Lab “Lecture 10” Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz

  2. Graphical User Interfaces (GUIs) Objectives • figure files; • application M-files; • callback functions. SUNY-New Paltz

  3. Basic structure of a GUI GUIDE: Graphical User Interface Development Environment GUIDE: generates 2 files : FIG-file and application M-file SUNY-New Paltz

  4. Basic structure of a GUI FIG-file contains a complete description of the GUI figure application M-file contains the functions required to launch and control the GUI. Callback functions, written by you, determine the action taken when you interact with a GUI component SUNY-New Paltz

  5. getting the time SUNY-New Paltz

  6. GUIDE SUNY-New Paltz

  7. Inspect Properties String property Tag property of the button is set to pushbutton1 Callback property myapp(’mybutton_Callback’,gcbo,[],guidata(gcbo)) SUNY-New Paltz

  8. Digital Clock SUNY-New Paltz

  9. Matlab Code % get time d = clock; % convert time to string time = sprintf( ’%02.0f:%02.0f:%02.0f’,d(4),d(5),d(6)); % change the String property of pushbutton1 set(gcbo,’String’,time) SUNY-New Paltz

  10. Time and Date SUNY-New Paltz

  11. Square Root GUI SUNY-New Paltz

  12. MATLAB Code function varargout = pushbutton1_Callback(h, eventdata, handles, varargin) % Stub for Callback of the uicontrol handles.pushbutton1. a = str2num(get(handles.edit1,’String’)); x = a; % initial guess for i = 1:8 x = (x + a/x)/2; str(i) = {sprintf(’%g’,x)}; end set(handles.edit1,’String’,’’); set(handles.text2,’String’,str) SUNY-New Paltz

  13. Plotting in a GUI SUNY-New Paltz

More Related