MATLAB Creating Graphical User Interfaces

(Barry) #1
Create Toolbars for Programmatic UIs

% Add a toggle tool to the toolbar
img2 = rand(16,16,3);
tth = uitoggletool(tbh,'CData',img2,'Separator','on',...
'TooltipString','Your toggle tool',...
'HandleVisibility','off');


fh is the handle of the parent figure.


th is the handle of the parent toolbar.


CData is a 16-by-16-by-3 array of values between 0 and 1. It defines the truecolor image
that is displayed on the tool. If your image is larger than 16 pixels in either dimension, it
may be clipped or cause other undesirable effects. If the array is clipped, only the center
16-by-16 part of the array is used.


NoteSee the ind2rgb reference page for information on converting a matrix X and
corresponding colormap, i.e., an (X, MAP) image, to RGB (truecolor) format.

Free download pdf