GUI: adjust axes values with 2 different sliders
Show older comments
I want to select 2 values chosen by 2 different sliders and set these values as the min and max of an axes. So, slider_a should give the min value of the axes, slider_b the max value of the axes. I failed to do so... here my initial code:
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
slider1_val=get(handles.slider1,'value')
set(handles.text1,'string',slider1_val)
get(handles.axes1,'Xlim')
set(handles.axes1,'Xlim',slider1_val) %%x min value should be slider1 val.; max slider2 val.
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Properties 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!