The easiest way to execute a menu item's command is to get a handle to the menu item and then inspect the Callback
property to see what it calls internally.
rotate_menu = findall(gcf, 'type', 'uimenu', 'tag', 'figMenuRotate3D');
rotate_menu.Callback
% 'toolsmenufcn Rotate'
As you can see this uses an internal function toolsmenufcn
which we could call directly to activate the tool.
toolsmenufcn(gcf, 'Rotate')
If you actually look at the contents of toolsmenufcn.m
(edit toolsmenufcn
), you will see a list of all available commands.
Using the toolsmenufcn
directly is of course undocumented so use at your own risk. On the other hand, dynamically retrieving and executing the Callback
for the menu should work across versions.