Is it possible to create a slider with a logarithmic scale within MATLAB 7.6 (R2008a)?

16 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The ability to specify a logarithmic scale for a slider is not available in MATLAB 7.6 (R2008a). To implement such a slider, you will need to convert its linear value into a logarithmic value before using it in your GUI.
For example, the following slider has a range of 10^0 to 10^2:
range = [10^0 10^2];
h = uicontrol('style', 'slider', ...
'position', [50 50 200 20],...
'min', log10(range(1)),...
'max', log10(range(2)),...
'callback', @(src,event)set(src,'UserData',10^get(src,'Value')));
To query the value of the slider, now you would need to query its "UserData" property instead of its "Value" property. For example,
get(h, 'UserData')
This slider has a leftmost value of 1 and a rightmost value of 100. Notice how the center value is 10, not 50.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!