%% Choose Context Menu Item for Specified Table Cell
% Create a table UI component that contains a mixture of different data types. Then, assign a context menu with two items to the table.

fig = uifigure;
uit = uitable(fig);
d = {'Male',52,true;'Male',40,true;'Female',25,false};
uit.Data = d;

cm = uicontextmenu(fig);
m1 = uimenu(cm,'Text','Menu1');
m2 = uimenu(cm,'Text','Menu2');
uit.ContextMenu = cm;

% Create an interactive test case and choose the menu item m2 by opening the context menu within the table cell with indices (1,1).

tc = matlab.uitest.TestCase.forInteractiveUse;
tc.chooseContextMenu(uit,m2,[1 1])

% Copyright 2020 The MathWorks, Inc.