I'm using the Image Acquisition Toolbox (imaqtool) to capture video from my Pike camera. In imaqtool I'm able to push a button to acquire video and then another button to save the video to an avi file. The imaqtool session log says that this is the code used:
vid = videoinput('gentl', 1, 'RGB8Packed');src = getselectedsource(vid);vid.FramesPerTrigger = 100;preview(vid);start(vid);stoppreview(vid);diskLogger = VideoWriter('C:\MATLAB\vidx.avi', 'Uncompressed AVI');open(diskLogger);data = getdata(vid, vid.FramesAvaialble);numFrames = size(data, 4);for ii = 1:numFrames writeVideo(diskLogger, data(:,:,:,ii));endclose(diskLogger);
However, when I copy this code to a script and run it I get this error:
Warning: No video frames were written to this file. The file may be invalid. > In VideoWriter.VideoWriter>VideoWriter.close at 289 In VideoWriter.VideoWriter>VideoWriter.delete at 238 In camera at 14 Error using imaqdevice/subsref (line 31)Invalid property: 'FramesAvaialble'.Type 'imaqhelp' for information.Error in camera (line 16)data = getdata(vid, vid.FramesAvaialble);
What am I doing wrong? Please help /Chris
Best Answer