File Exchange

image thumbnail

dial

version 1.0.0.0 (32.6 KB) by Kevin Bartlett
Rotary graphical user interface control

1 Download

Updated 26 Jun 2008

View License

Creates a "dial"-style graphical user interface control.

Similar in operation and programming interface to Matlab's slider-style uicontrols, but moves in a rotary fashion, rather than linearly. Also different in that a dial control can take minimum and maximum values of -Inf and +Inf.

Install by putting "dial" directory on your Matlab path (do NOT add the "dial/@dial/" directory to your path).

Run the dial_demo.m program for examples of how to use dial.m.

Known bugs: dial objects sometimes very slow to appear and sluggish in response to user inputs. This seems random, and is apparently something internal to Matlab. Closing the figure and regenerating the dial object usually makes the problem go away.

Cite As

Kevin Bartlett (2020). dial (https://www.mathworks.com/matlabcentral/fileexchange/20431-dial), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (14)

Gabriel

doesn't work with gui made with guide

Heng Xu

Very nice UI but doesn't work well with MATLAB Layout Toolbox. However, I made some changes to make it work.
1. Add a property to pass in the parent container
2. modify all the axes() to set this container as parent

Kevin Bartlett

@Stephen Westland--I'm still stuck with Matlab 2011, so I can't say for sure whether dial is broken under the newest Matlab. It seems unlikely this is the case, though, if the dial_demo program is still working. You may be seeing the result of stacking of other graphics objects atop the dial objects, which would obscure them from the user. All I can suggest is that you build up your GUI from simple to more complex, using dial_demo.m as a basis. Add graphics objects line by line (rather than by running a script), and see at what point the dial object(s) become invisible.

Stephen Westland

The demo works ok. But when I try to put this in my GUI although everything seems to run ok and the dial objects are created, nothing appears on the figure. Is it something to do with the fact that it is 2016 and this code was created in 2008?

Andre Silva

Great I borrowed the draggableComponents line and it worked from there. Thanks again.

Kevin Bartlett

@Andre Silva--Try the following code, which makes use of the "find_dial" method:

dial_demo;
dialObj = dial.find_dial('noSnapDial','-1');
draggableComponents = [dialObj.dialFaceHndl dialObj.circlePointerHndl dialObj.linePointerHndl];
set(draggableComponents,'ButtonDownFcn',[]);
set(dialObj,'Value',6)
set(findobj('Tag','noSnapText'),'string',sprintf('%f',dialObj.Value));

The "no snap" dial (on the far left of the figure) will no longer be draggable by mouse, and the value (and the associated text object) is set to 6.

Andre Silva

How to disable the user controlled dial. I want to have the dial move based on a condition that happens in the callback. Any way to do this?

Thanks!

dong van duc

Can I creat the "dial_demo" to a block in sumilink?

dong van duc

thank you

dong van duc

Mahmudul Hassan

Yu Ang Tan

Tim

Dimitri Shvorob

Works great, but 2000 lines of code (!) and 45 MLINT messages suggest a scope for improvement.

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!

dial/

dial/@dial/