Changing the Limits of the Slider

As seen in the previous example, the slider took default values from 0 to 100. However, we can change the same to any desired limits using the following method.

Example 2:

Matlab




% Code
fig = uifigure;
slid = uislider(fig);
%changing the limits to, from -23 to 23
slid.Limits = [-23 23];


By using the slider_object.Limits property of uislider, we can change the limits of the slider to any desired value; range given as a vector.

Output:

 

Create a Slider Component in MATLAB

A slider component is a graphical interface that allows the end users to select discrete values in the range of the slider component. MATLAB provides built-in functionalities to create slider components in a MATLAB figure component.

This article will explain how to create a slider component in MATLAB and the various options available with it. 

Similar Reads

Creating Slider Component

The uislider function creates a new slider object in a new uifigure component unless no parent figure component exists. The syntax for the same is:...

Changing the Limits of the Slider

...

Using the Slider Value

As seen in the previous example, the slider took default values from 0 to 100. However, we can change the same to any desired limits using the following method....