varying image properties Using MATLAB slider

1 view (last 30 days)
I'm not using slider for viewing image/graph on axes by sliding it. Code shown below is a part of my m-file.
function slider2_Callback(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
%eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fname = getappdata(0, 'fname');
[a, map] = imread(fname);
x = ind2rgb(a, map);
b = get(handles.slider2,'value');
j = imadjust(x,[],[],b);
axes(handles.axes1);
imshow(j);
b in above code is a variable. The moment I slide the slider image brightness changes but at first when I run the code slider's initial point will be in extreme left. But for above code slider should be at the center.
How can i set values( to increase/decrease brightness) to that slider? How can i go for it?

Accepted Answer

David Sanchez
David Sanchez on 31 Jul 2013
To make sure your slider initialize in any value of your liking, place the set function on the start-up function of your GUI.
set(handles.slider2,'value','your_value_here');

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!