MATLAB: Slider direction max min

maxminslider

Hi, can you help me? I have slider, I set max and min value, Is it possible to set direction of slider from max to min? It goes from min to max, but I need decresing of value – from max to min. But I dont know how, Thanks for any help

Best Answer

How about adding a label at each end of the slider to indicate "min" to "max," and use the correct value (ex. -1*sl.Value in the following example) inside the program ?
h = figure;
sl = uicontrol(...
'Parent', h,...
'Units', 'normalized',...
'Position', [0.2 0.5 0.6 0.05],...
'Style', 'slider',...
'Min', -1,...
'Max', 1);
uicontrol(...
'Parent', h,...
'Units', 'normalized',...
'Position', [0.1 0.5 0.1 0.05],...
'Style', 'text',...
'FontSize', 12,...
'String', '+1');
uicontrol(...
'Parent', h,...
'Units', 'normalized',...
'Position', [0.8 0.5 0.1 0.05],...
'Style', 'text',...
'FontSize', 12,...
'String', '-1');