Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
HELP ME, Arrgh.. close(vid) on image acquisition

Subject: HELP ME, Arrgh.. close(vid) on image acquisition

From: Ashar

Date: 24 Apr, 2010 10:52:22

Message: 1 of 1

Arghh... so frustating...

anybody knows how to use close(vid) ? I'm Matlab GUI user but I've problem using close(vid) in push_button_2 callback function, say... my GUI has two push button and one axis to display image. i use push_button_1 to set video using image acquisition toolbox, and display it into axis. but when i press push_button_2 to stop video input the error occur. matlab says Reference to non-existent field 'vid'. i tried close(handles.vid) instead of close(vid), but it doesnt work. here is my simple code :


%%%%%% PUSH_BUTTON_1_CALL_BACK_FUNCTION %%%%%%%%
function pushbutton1_Callback(hObject, eventdata, handles)
handles.vid = videoinput('winvideo',1,'RGB24_320x240');
set(handles.vid,'TriggerRepeat',inf);
triggerconfig(handles.vid,'manual');
set(handles.vid,'FramesPerTrigger',1);
start(handles.vid);
while (handles.vid.FramesAcquired<=50)
   trigger(handles.vid);
   data_image=getdata(handles.vid,1);
   handles.axes1,imshow(data_image);
   flushdata(vid);
end
stop(handles.vid);


%%%%%% PUSH_BUTTON_2_CALL_BACK_FUNCTION %%%%%%%%
function pushbutton2_Callback(hObject, eventdata, handles)
stop(handles.vid);

the close(vid) only works when i use it in the same call_back_function where start(vid) is exist. please helpme... thanks for reading my post.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us