14 Examples of UIs Created Programmatically
Setting the z-values ensures that the markers plot on top of the lines.
5 Assigns x-, y-, and z-values to the XData, YData, and ZData of each vector of
markers, and makes the markers visible again.
Only markers with nonempty data display.
The Plot Check Box callback
The three Plot check boxes all share the same callback, plot_callback. It has a
column argument in addition to the standard hObject and eventdata parameters. The
column argument identifies which box (and column of data) the callback is for.
The plot_callback also uses handles found in the function workspace for the following
purposes:
- htable — To fetch table data and column names for plotting the data and deleting
lines; the column argument identifies which column to draw or erase. - haxes — To draw lines and delete lines from the axes.
- hprompt — To remove the prompt (which only displays until the first line is plotted)
from the axes.
Keying on the column argument, the callback takes the following actions:
- Extracts data from the table and calls plot, specifying data from the given column as
YData, and setting its DisplayName property to the column's name. - Deletes the appropriate line from the plot when a check box is deselected, based on
the line's DisplayName property.
Here is the plot_callback code:
function plot_callback(hObject, eventdata, column)
% hObject Handle to Plot menu
% eventdata Not used
% column Number of column to plot or clear
colors = {'b','m','r'}; % Use consistent color for lines
colnames = htable.ColumnName;
colname = colnames{column};
if (hObject.Value)
% Turn off the advisory text; it never comes back
hprompt.Visible = 'off';