UI for a Program That Accepts Arguments
1 Clicking a color cell toggle button makes the program perform these actions:
- Display the selected color in the preview area.
- Display the red, green, and blue values for the newly selected color are displayed
in the R, G, and B fields in the UI.
2 Clicking the Eraser toggle button is equivalent to selecting no color.
3 Clicking the More Colors button displays a second dialog box containing more
colors.
4 Clicking the close box on the main dialog returns a function handle. You can call the
returned function to get the RGB values of the selected color. For example, this code
calls the ColorPalette program, which returns a function handle in the variable,
getmycolor. The second line calls getmycolor to get the RGB values.
getmycolor = colorPalette;
rgb = getmycolor();
The getmycolor function returns a 1-by-3 vector of values. It returns a NaN value if
the user selects the Eraser button.
Call the colorPalette Function With Input Arguments
You can call the colorPalette function with input arguments: