How Do I Set Slider Handles in Matlab?

Save

Matlab comes with a built-in graphical user interface editor that you can use to create GUI without having to code everything from scratch. The editor lets you select objects from a palette of precoded GUI objects, such as sliders, check boxes and push buttons. After you've placed a pre-coded object into a GUI, you can customize the object with the property inspector and by tweaking code.

How Do I Set Slider Handles in Matlab?
Step 1

Type guide in the Matlab command window and press Enter.

Step 2

Open an existing GUI project from the list of saved projects. Click the slider icon on the objects palette to add a slider to your GUI.

Step 3

Double-click the slider object to open the property inspector. Change Tag to your preferred name for the slider.

Step 4

Click the Save icon in the GUI editor, and your GUI's code should appear. If not, click the pencil and paper icon to open the code.

Step 5

Scroll down the code until you see the slider1_Callback function.

Step 6

Type n = get(handles.Handlename,'Value'); below the last line of the slider1_Callback function. "Handlename" should be the name of another object, such as a text box, at whose value you want to set the slider.

Step 7

Type set(handles.slider1,'Value',n)); below the last line of the line you typed previously to pass the value from the other handle to your slider. Set your slider at that value.

Tips & Warnings

  • Always add a semicolon at the end of every complete line of code.

References

Promoted By Zergnet

Comments

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!