ASE 201 - Creating a GUI with multiple plots

ASE 201 - Creating a GUI with multiple plots - 4. Example...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Creating a GUI with multiple plots 1. Guide creates a gui and the gui itself is figure 1. You add axes for plotting inside of figure 1. 2. In order to plot into different sets of axes, you need to know the handle of the axes you want to use. The function plot(x,y) will plot into the current set of axes. This is the set of axes that were created last in your gui. If you only have one set of axes, there is no problem. 3. If you want to plot into multiple sets of axes, you need the handle of the set of axes you want to use. You can use the findobj() function to do this. See section 9.6 findobj(‘type’,’axes’) will return the handles of all of the objects whose ‘type’ field has ‘axes’ in it. The handles are assigned at run time and differ every time your gui is called.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4. Example Code: axes1 and axes2 were created by guide. This is a pushbutton callback code that plots a sin function into the first set of axes and a straight line into the second set of axes. . Ht1 will be an array with the handles of all of the axes. Ht1(1) is the handle of axes 2 and Ht1(2) is the handle of axes1. I believe they are entered into Ht1 in the reverse order in which they were created. 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) t=0:.1:1; y=sin(pi*t); w=t; ht1=findobj( 'type' , 'axes' ) plot(ht1(1),t,w); plot(ht1(2),t,y);...
View Full Document

This note was uploaded on 09/16/2011 for the course ASE 201 taught by Professor Hayes during the Fall '07 term at University of Texas.

Ask a homework question - tutors are online