Download presentation
Presentation is loading. Please wait.
Published byNora Greer Modified over 9 years ago
1
Introduction to Matlab & Data Analysis 2015 In this tutorial we will: Build a practical application using GUIDE Learn more about graphical user interface components Practice building callback functions that display data and manipulate the GUI This will be a step-by-step design procedure 1GUIDE Tutorial
2
1.Open a blank template in GUIDE 2.Open the Preferences dialog and toggle the “Show names” option 2GUIDE Tutorial
3
3. Add a push button 4. Duplicate this button 2 times to create 3 buttons 3GUIDE Tutorial
4
5. Add a panel to contain our buttons. Move the buttons on to the panel. 6. Add an axis for the surface plot 4GUIDE Tutorial Adjust the window size by moving this corner
5
GUIDE Tutorial5 7. You can align and distribute components
6
GUIDE Tutorial6 8. Open the Properties Inspector of each push button and change the String and the Tag
7
GUIDE Tutorial7 9. Using the Properties Inspector, edit the options string for the pop-up menu 10. At this point you can activate the GUI, this will generate an *.m file and a *.fig file
8
GUIDE Tutorial8 11. We will now go to the opening function which is called when the GUI starts * To share data between the GUI objects we use the handles structure which is passed between functions
9
GUIDE Tutorial9 12. Here we will define three datasets and create and initial plot * To share data between the GUI objects we use the handles structure which is passed between functions
10
GUIDE Tutorial10 13. Now we will edit the callback functions of the pushbuttons to update the 2D plotting method handles.current_data stores our current dataset
11
GUIDE Tutorial11 14. And finally we need to update the callback of the pop-up menu to update the right dataset Don’t forget to update the handles structure using the function guidata()
12
GUIDE Tutorial12 15. Now your GUI should be fully functional. You can activate it from the editor, layout editor or the command line
13
GUIDE Tutorial13 1. Create a new GUI layout called ‘slider’. This GUI will slide to the right MRI slice
14
GUIDE Tutorial14 2. In the opening function, load the MRI data and display the first slice
15
GUIDE Tutorial15 3. In the slider callback function we shall calculate the requested frame number and display it
16
GUIDE Tutorial16 4. Try to slide through the axial slices of the dataset
17
GUIDE Tutorial17 5. Now let’s display the current slice number in the static text set(handles.frame_num,'string',num2str(handles.current_frame)); guidata(hObject, handles);
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.