How Can I close a video while playing in MATLAB GUI

The following error I get it while running a code file
Reference to non-existent field 'aviobj'.
Error in final>CloseVideo_Callback (line 287) handles.aviobj
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in final (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)final('CloseVideo_Callback',hObject,eventdata,guidata(hObject))

 Accepted Answer

After you assigned a value to handles.aviobj, did you use
guidata(hObject, handles)
to update the master copy of the handles structure?

8 Comments

I already assign this but still the error is showing in aviobj non existent file.
Reference to non-existent field 'aviobj'.
I donno what I want to do..plz help
This is my code for closing a video while recording a video..
function CloseVideo_Callback(hObject, eventdata, handles)
% hObject handle to CloseVideo (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if ~isfield(handles, 'format')
h = warndlg('Video settings are not ready, redo it','!! Warning !!');
pause (5);
if ishandle(h), close (h); end;
return;
end
if isfield(handles, 'vid')
h = warndlg('Video not closed!','!! Warning !!');
pause (5);
if ishandle(h), close (h); end;
return;
end
% Update handles structure
guidata(hObject, handles);
handles.aviobj
stop(handles.aviobj)
% close(handles.aviobj)
% delete(handles.aviobj)
handles = rmfield(handles,'aviobj');
clear handles.aviobj;
% aviobj = close(aviobj.DiskLogger);
% update handles
handles.output = hObject;
handles.output = hObject
% Update handles structure
guidata(hObject, handles);
We need the code where you create handles.aviobj
Set a breakpoint on this line:
handles.aviobj
Then type that onto the command line and see what it says. You do not assign handles.aviobj in that function so if it doesn't already exist (already attached to handles) when you enter the function, then I'd think that line would cause an error. If it does exist already, then prove it by showing us the function that attaches aviobj to the handles structure.
Finally I getting this error
Warning: AVIREAD will be removed in a future release. Use VIDEOREADER instead.
then Videoreader command not working on MATLAB 2012a...what I do
Make sure you use VideoReader with capital V and capital R, not lower-case R.
Thank You walter Roberson sir...:-)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!