Hi Christian,
From the provided details, I gather that you are looking for an alternative to uisplittool as it is an un-documented built-in MATLAB tool, which will be removed in future releases. You are using this tool to create a selectable dropdown on an image in the toolbar.
It is important to note that the uisplittool creates a separate button in the toolbar, which is essentially a button split into two sections. One section (image icon) performs an action immediately (primary action), and the other section displays a dropdown arrow that, when clicked, reveals a dropdown menu with additional options (secondary actions).
While there's no direct alternative to uisplittool in MATLAB, there's a promising workaround using uipushtool. This tool, although not designed for splitting into two parts, can simulate the behavior by inserting an image icon in the toolbar. It reveals a context menu (dropdown) below the toolbar when clicked.
You can refer to the provided workaround to get more clarity on the implementation:
fig = figure('Toolbar', 'none', 'MenuBar', 'none', 'Name', 'Custom Toolbar Dropdown', 'WindowButtonDownFcn', @(src, event)hideContextMenu(src));
icon = fullfile(matlabroot,'/toolbox/matlab/icons/greenarrowicon.gif');
[cdata,map] = imread(icon);
map(map(:, 1) + map(:, 2) + map(:, 3) == 3) = NaN;
cdataRedo = ind2rgb(cdata,map);
pt = uipushtool(tb,'cdata',cdataRedo,'TooltipString','Dropdown Menu', 'Separator', 'on');
pt.ClickedCallback = @(src, event)dropdownClicked(src, event, fig);
function dropdownClicked(~, ~, fig, flag)
items = {'Movement Function', 'Transformation Function', 'Experiment Code'};
uimenu(cm, 'Label', items{i}, 'Callback', @(s,e)disp(['Selected Option: ', items{i}]));
cm.Position = dropdownPos;
function hideContextMenu(src)
It is worth highlighting that the above approach allows for a primary action (displaying the context menu) and secondary actions (the items within the context menu) from a single toolbar button.
For more information, you can visit the following documentation of uipushtool and uicontextmenu:
I trust this explanation addresses your query.
Thanks