MATLAB Creating Graphical User Interfaces

(Barry) #1
Synchronized Data Presentations in a GUIDE UI

Open plot in new window. The static text string (tagged newfig) above the plot panel,
Right-click plots for larger view, informs you that this feature is available.


The axes respond by:


1 Creating a new figure window.


2 Copying their contents to a new axes parented to the new figure.


3 Resizing the new axes to use 90% of the figure's width.


4 Constructing a title string and displaying it in the new figure.


5 Saving the figure and axes handles in the handles structure for possible later use or
destruction.


Note:Handles are saved for both plots, but each time a new figure is created for
either of them, the new handles replace the old ones, if any, making previous figures
inaccessible from the UI.

Create Two Context Menus


To create the two context menus, from the GUIDE Tools menu, select the Menu Editor.
After you create the two context menus, attach one to the each axes, axes1 and axes2.
In the Menu Editor, for each menu:


1 Click the Context Menus tab to select the type of menu you are creating.


2
Click the New Context Menu icon.


This creates a context menu in the Menu Editor workspace called untitled. It has
no menu items and is not attached to any UI object yet.

3 Select the new menu and in the Tag edit field in the Menu Properties panel, type
plot_axes1.


(^4) Click the New Menu Item icon.
A menu item is displayed underneath the plot_axes1 item in the Menu Editor
workspace.
5 In the Menu Properties panel, type Open plot in new window for Label and
plot_ax1 for Tag. Do not set anything else for this item.
6 Repeat the last four steps to create a second context menu:

Free download pdf