User`s guide
Create Menus for a Programmatic GUI
fh = figure('Position',[300 300 400 225]);
cmenu = uicontextmenu('Parent', fh,'Position',[10 215]);
At this point, the figure is visible, but not the menu.
Note “Force Display of the Context Menu” on page 11-86 explains the use of
the
Position property.
Add Menu Items to the Context Menu
Use the uimenu function to add items to the context menu. The items appear
onthemenuintheorderinwhichyouaddthem. Thefollowingcodeadds
three items to the context menu created above.
mh1 = uimenu(cmenu,'Label','Item 1');
mh2 = uimenu(cmenu,'Label','Ite m 2');
mh3 = uimenu(cmenu,'Label','Ite m 3');
If you could see the context menu, it would look like this:
11-83