I need to update the variable frame2display dynamically. But the following code isnt working. How should I modify it? I would like to stick with using GUIDE. Thanks.
function getMCavi_Callback(hObject, eventdata, handles)handles = guidata(hObject);[fname,~,~] = uigetfile('*.avi*','Select the motion stablized .avi video',pwd); VidObj_stbl = VideoReader(fname);nframes_all=round((VidObj_stbl.Duration)/(1/VidObj_stbl.FrameRate));for m=1:nframes_all temp=(readFrame(VidObj_stbl,'native')); imframes_all(:,:,m)=temp(:,:,1);end;imframes_all = double(imframes_all);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%confusing portion %%%%%%%%%%%%%%%%%%%%%%%%%%%
handles.slider_value = addlistener(handles.slider_frameNum,'Value', 'PostSet', ... @(hObject,eventdata)test2('slider_frameNum_Callback',hObject,eventdata,guidata(hObject)));slider_value = handles.slider_value;display(slider_value);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%frame2display = slider_value;if frame2display == 0 frame2display = 1; endimg = squeeze(imframes_all(:,:,frame2display));imagesc(img, 'Parent', handles.MCimages); axis equal tight off; colormap gray guidata(hObject,handles)% --- Executes on slider movement.
function slider_frameNum_Callback(hObject, eventdata, handles)handles = guidata(hObject);slider_value = get(hObject,'Value');handles.slider_value = slider_value; guidata(hObject,handles)
Best Answer