Introduction to Matlab & Data Analysis 2015 In this tutorial we will: • Build a practical application using GUIDE • Learn more about.
Download ReportTranscript Introduction to Matlab & Data Analysis 2015 In this tutorial we will: • Build a practical application using GUIDE • Learn more about.
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 1 GUIDE Tutorial 1. 2. 2 Open a blank template in GUIDE Open the Preferences dialog and toggle the “Show names” option GUIDE Tutorial 3. Add a push button 4. Duplicate this button 2 times to create 3 buttons 3 GUIDE Tutorial 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 4 GUIDE Tutorial 7. You can align and distribute components 5 GUIDE Tutorial 8. Open the Properties Inspector of each push button and change the String and the Tag 6 GUIDE Tutorial 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 7 GUIDE Tutorial 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 8 GUIDE Tutorial 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 9 GUIDE Tutorial 13. Now we will edit the callback functions of the pushbuttons to update the 2D plotting method handles.current_data stores our current dataset 10 GUIDE Tutorial 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() 11 GUIDE Tutorial 15. Now your GUI should be fully functional. You can activate it from the editor, layout editor or the command line 12 GUIDE Tutorial 1. Create a new GUI layout called ‘slider’ . This GUI will slide to the right MRI slice 13 GUIDE Tutorial 2. In the opening function, load the MRI data and display the first slice 14 GUIDE Tutorial 3. In the slider callback function we shall calculate the requested frame number and display it 15 GUIDE Tutorial 4. Try to slide through the axial slices of the dataset 16 GUIDE Tutorial 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); 17 GUIDE Tutorial