Uicontrol('style','slider', 'position',) % Standard Java JSlider (20px high if no ticks/labels, otherwise use 45px) % Standard Matlab "slider" uicontrol ( 'style', 'slider', 'position', )
Using Java Swing’s standard JScrollBar control would at least have made it appear more consistent with the other Matlab controls, which are all based more closely on Java Swing: It gets worse: for some reason Matlab’s implementation of the so-called “slider” uses a Windows95 look-and-feel that makes the control look antique in today’s GUI standards. Spoiler alert: this will change soon - keep reading. So to this day, Matlab’s so-called “slider” is actually a scroll-bar, and we do not have a real slider control in standard Matlab, apparently since the ‘slider’ uicontrol style is already in use. This was never corrected, probably for backward-compatibility reasons. I believe that this is due to a design decision that occurred sometime in the 1990’s (sliders were not as prevalent then as they are nowadays). Today’s post is an expansion of the answer I provided him, which I though might interest other Matlab users.Īs funny as it may sound, Matlab’s so-called “slider” control ( uicontrol('Style','slider')) is actually implemented as a scroll-bar, rather than the more natural JSlider. One of my consulting clients asked me last week if I knew an easy way to integrate a range (dual-knob) slider control in Matlab GUI.