How do I create a context sensitive menu for an object in a figure generated by GUIDE ?

1 view (last 30 days)
I have a figure generated by GUIDE. It contains a few axes that I want to be able to copy to the clipboard. I wish to do it by right-clicking on the axes and select a context-sensitive menu that contains 'Copy' as an option.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Jul 2009
The attached files "twoaxescontextmenu.fig" and "twoaxescontextmenu.m" created using GUIDE explain how to create a context-sensitive menu on objects in a figure generated using GUIDE. Although, these files are coded to have a context menu to copy an axes in a figure to clipboard or save as JPEG, this can be modified to create any context menu of choice.
Following are the instructions to execute the file:
1. Run the attached files using GUIDE
2. When the figure opens up, it contains two axes, and a drop-down menu corresponding to each axes. To update the axes with a figure of choice, select the desired option from the drop-down menu and click 'Update'.
3. Place the mouse in one of the two axes and right-click. There will be two ptions: 'Copy to Clipboard', and 'Copy to JPG'.
4. Select one of the two options. If 'Copy to JPG' is chosen a new file JPG file is created in the current directory. If 'Copy to Clipboard' is chosen, the axes gets copied to the clipboard.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products


Release

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!