jRangeSlider Callback Issue - "Not enough input arguments"
显示 更早的评论
I'm trying to make a GUI with a jRangeSlider such that the frames that play depend on the user moving the sliders. Ultimately, The two knobs are used to determine a specific time frame within a larger video.
For now, I'm having problems with creating the Callback function so that the video figure updates when the slider moves. Either I get a "Not enough input arguments" error (I have no idea why, since everything has three inputs), or I can't get handles from guidata(hObject).
This is OpeningFcn code for the GUI.
jRangeSlider = com.jidesoft.swing.RangeSlider(0,10, 4, 6);
handles.jRangeSlider = javacomponent(jRangeSlider, [55,50,750,75]);
set(handles.jRangeSlider, 'PaintTicks',true, 'PaintLabels',true, 'Background',java.awt.Color.white, ...
'StateChangedCallback',@(hObject, eventdata, handles) rangeslider_Callback(hObject, eventdata, handles));
guidata(hObject, handles)
And this is the callback
function rangeslider_Callback(hObject, eventdata, handles)
low = jRangeSlider.getLowValue();
handles = guidata(hObject);
footage = VideoReader('Time.mp4', 'CurrentTime', low);
image(handles.realvid, readFrame(footage))
I simplified the code quite a bit, so the callback kind of doesn't make sense since it only changes upon moving the lower knob. In reality, it would update based on both, but this is a shorter version with similar functionality.
Thanks!
4 个评论
Kairui Zeng
2019-5-28
Geoff Hayes
2019-5-28
Kairui - why are you using a jRangeSlider instead of the usual horizontal or vertical slider?
Kairui Zeng
2019-5-28
Kairui Zeng
2019-5-28
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!