Synchronized Data Presentations in a Programmatic UI
xvals = sel(:,1);
xvals(sel(:,2) ~= col) = [];
yvals = table(xvals, col)';
% Create Z-vals = 1 in order to plot markers above lines
zvals = col*ones(size(xvals));
% Plot markers for xvals and yvals using a line object
hmkrs(col).Visible = 'on';.
hmkrs(col).XData = xvals;
hmkrs(col).YData = yvals;
hmkrs(col).ZData = zvals;
end
end
The function passes the rows and columns of the user-selected cells in
eventdata.Indices and copies them into sel. For example, if the user selects all three
columns in row 3 of the table, then
eventdata =
Indices: [3x2 double]
sel =
3 1
3 2
3 3
If the user selects rows 5, 6, and 7 of columns 2 and 3, then
eventdata =
Indices: [6x2 double]
sel =
5 2
5 3
6 2
6 3
7 2
7 3
After hiding all the markers, the callback performs these tasks:
1 Identifies the unique columns that the user selected.
2 Iterates over the unique columns to find the row indices for the selection.
3 Sets the x-values for all row indices that do not appear in the selection to empty.
4 Uses the vector of x-values to copy y-values from the table and specify dummy z-
values.