jRangeSlider Callback Issue - "Not enough input arguments"
Mostrar comentarios más antiguos
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 comentarios
Kairui Zeng
el 28 de Mayo de 2019
Geoff Hayes
el 28 de Mayo de 2019
Kairui - why are you using a jRangeSlider instead of the usual horizontal or vertical slider?
Kairui Zeng
el 28 de Mayo de 2019
Kairui Zeng
el 28 de Mayo de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!