MATLAB Creating Graphical User Interfaces

(ff) #1
To display the & character in a label, use two & characters. The words remove,
default, and factory (case sensitive) are reserved. To use one of these as a label,
prepend a backslash character (\). For example, \remove yields remove.

The radio button accommodates only a single line of text. If you specify more than one
line, only the first line is shown. If you create a radio button that is too narrow to
accommodate the specified String property value, MATLAB software truncates the
value with an ellipsis.


  • Create the radio button with the button selected by setting its Value property to the
    value of its Max property (default is 1 ). Set Value to Min (default is 0 ) to leave the
    radio button unselected. Correspondingly, when the user selects the radio button, the
    software sets Value to Max, and to Min when the user deselects it.

  • If you want to set the position or size of the component to an exact value, then modify
    its Position property.

  • To add an image to a radio button, assign the button's CData property an m-by-n-by-3
    array of RGB values that defines a truecolor image. You must do this programmatically
    in the opening function of the code file. For example, the array img defines a 16-by-24-
    by-3 truecolor image using random values between 0 and 1 (generated by rand).


img = rand(16,24,3);
set(handles.radiobutton1,'CData',img);

NoteTo manage exclusive selection of radio buttons and toggle buttons, put them in a
button group. See “Button Group” on page 6-42 for more information.

Add Components to the GUIDE Layout Area
Free download pdf