Monday, 2 December 2013

How to use Toggle button, Radio button and Checkbox in MATLAB GUI?


AIM: Study and Implementation of Toggle button, Radio button and Checkbox in MATLAB GUI.
PROCEDURE:
1. For opening GUI tool simply type following command in command window.
>> guide
This command will open GUI toolbox.

Fig: 1 GUI menu bar with Toggle button, Radio button and Checkbox
2. In second step simply click over Popup menu as mentioned in fig 1. Drag that Toggle button, Radio button and Checkbox in empty space as mentioned in fig 2.

Fig: 2 GUI with Toggle button, Radio button and Checkbox
3. Next step is to change the properties of the Toggle button, Radio button and Checkbox. For this just double click on each of the button this action will open property inspector. Property inspector consists of various properties. You have to change background color if necessary, font size, font weight, remember tag of the Toggle button, Radio button and Checkbox or keep tag as it is, you have to change the string of the Toggle button, Radio button and Checkbox or keep strings as it is. Our aim is to display status of the button on Static text, whether it is on or off.

Fig: 3 Final fig file with Toggle button, Radio button and Checkbox
4. Next thing is to right click on Toggle button and open callback, write linking code there to make a connection between Toggle button and Static text as shown in fig 4.
 

Fig: 4 m file with linking code of Radio button.
5. Next thing is to right click on Checkbox and open callback, write linking code there to make a connection between Checkbox and Static text as shown in fig 5.

Fig: 5 m file with linking code of Checkbox. 

6. Similarly do it for toggle button as shown in fig 6. Finally fig 7 and fig 8 shows you final ON and OFF status of the buttons.

Fig: 6 m file with linking code of toggle button.

Fig: 7 When all the buttons are ON

Fig: 8 When all the buttons are OFF



1 comment: