A new UICONTROL object with a slider as a child of a uipanel, with auto-linked edit box and labels.
Updated 1 Sep 2016

View License

Editor's Note: This file was a File Exchange Pick of the Week

An indispensible uicontrol: linked slider, text, and labels all self-contained in a panel.
sliderHandle,panelHandle,editHandle] = sliderPanel(parent, PanelPVs, SliderPVs, EditPVs, LabelPVs, numFormat)

Creates a slider in a separate uipanel, with an associated interactive EditBox, and left and right labels showing the minimum and maximum values of the slider, respectively.

Moving the slider automatically updates the textbox, and vice versa. Both slider movement and text edits will trigger (non-recursively) the callback of the slider.

The EditBox automatically disallows the entry of non-numeric values, or of values outside of [min,max]. Attempts to enter disallowed values will be ignored.

Two syntaxes are supported. One gives FULL control over all elements of the sliderPanel, and a second provides easier access to a subset of the functionality.

UPDATE: Right-clicking the slider now resets the sliderPanel to its default (creation) value.

Cite As

Brett Shoelson (2024). sliderPanel (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Migrate GUIDE Apps in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Updated license

Right-clicking now resets the slider to its default (creation) value.

Right-clicking the slider now resets the sliderPanel to its default (creation) value.

Now automatically includes right-click reset to default (initial) value!

Updated M file and license text file copyright to The MathWorks, Inc.

added copyright

This is a bug fix; in adding simplified syntax, I broke support for structs. Also, no 'Parent' arg now needed in simplified syntax.