Friday, 29 November 2013

How to use Slider in MATLAB GUI?

AIM: Study and Implementation of Slider in MATLAB GUI.

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 Slider

2. In second step simply click over slider as mentioned in fig 1. Drag that slider in empty space as mentioned in fig 2.

Fig: 2 GUI with a Slider

3. Next step is to change the properties of the slider. For this just double click on slider this action will open property inspector. Property inspector consists of various properties of the slider. You have to change background color if necessary, font size, font weight, remember tag of the slider or keep tag as it is, you have to change the string of the slider and finally you have to change minimum and maximum limit of the slider as shown in fig 3.

Fig: 3 Property Inspector of Slider with Max and Min value
4. Our aim is to display respective value of slider in static text. After dragging slider and static text in empty GUI final figure looks like following fig 4.

Fig: 4 Final fig file with slider and static text.

5. Next thing is to right click on slider and open callback, write linking code there to make a connection between slider and static text as shown in fig 5. Fig 6 & 7 shows final output of the slider.

Fig: 5 m file with linking code.

Fig: 6 Before sliding

Fig: 7 After sliding

YouTube Video

No comments:

Post a comment