In order to do this, first create the file loggerFcn.m with the following contents:
function loggerFcn(vidObj, eventData, logger)
writeVideo(logger, getdata(vidObj, 1));
Then use the following code to create and configure the objects:
% Create videoinput object with appropriate paramaters.
vid = videoinput(...);
vid.FramesPerTrigger = 10000;
% Create a VideoWriter object.
logger = VideoWriter('myfile.avi', 'Uncompressed AVI');
open(logger);
vid.FramesAcquiredFcn = {@loggerFcn, logger};
vid.FramesAcquiredFcnCount = 1;
start(vid);