Introduction to Matlab & Data Analysis 2015 In this tutorial we will: Build a practical application...
-
Upload
nora-greer -
Category
Documents
-
view
212 -
download
0
Transcript of Introduction to Matlab & Data Analysis 2015 In this tutorial we will: Build a practical application...
GUIDE Tutorial1
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
GUIDE Tutorial2
1. Open a blank template in GUIDE2. Open the Preferences dialog and toggle the “Show names” option
GUIDE Tutorial3
3. Add a push button4. Duplicate this button 2 times to create 3 buttons
GUIDE Tutorial4
5. Add a panel to contain our buttons. Move the buttons on to the panel.6. Add an axis for the surface plot
Adjust the window size by moving this corner
GUIDE Tutorial5
7. You can align and distribute components
GUIDE Tutorial6
8. Open the Properties Inspector of each push button and change the String and the Tag
GUIDE Tutorial7
9. Using the Properties Inspector, edit the options string for the pop-up menu10. At this point you can activate the GUI , this will generate an *.m file and a *.fig file
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
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
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
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()
GUIDE Tutorial12
15. Now your GUI should be fully functional. You can activate it from the editor, layout editor or the command line
GUIDE Tutorial13
1. Create a new GUI layout called ‘slider’ . This GUI will slide to the right MRI slice
GUIDE Tutorial14
2. In the opening function, load the MRI data and display the first slice
GUIDE Tutorial15
3. In the slider callback function we shall calculate the requested frame number and display it
GUIDE Tutorial16
4. Try to slide through the axial slices of the dataset
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);