Similar to imwrite, except follows a strict naming convention. Wrapper for imwrite that writes file to the filename: imagename = [path name int2str2(i,ndigits) '.' ext]; Using imwrite: imwrite( I, imagename, writeparams ) If I represents a stack of images, the ith image is written to: imagenamei = [path name int2str2(i+imagei-1,ndigits) '.' ext]; If I=[], then imwrite2 will attempt to read images from disk instead. multflag controls how I is interpreted. If multflag==0, then I is intrepreted as a single image, otherwise I is interpreted as a stack of images, where I(:,:,...,j) represents the jth image (see feval_arrays for more info). If the directory specified by 'path' does not exist, imwrite2 attempts to create it. INPUTS I - image or array or cell of images (if [] reads else writes) multflag - set to 1 if I represents a stack of images imagei - first image number path - directory where images are name - base name of images ext - extension of image ndigits - number of digits for filename index writeparams - [varargin] additional parameters to imwrite OUTPUTS I - image or images (read from disk if input I=[]) EXAMPLE load images; clear IDXi IDXv t video videos; imwrite2( images(:,:,1), 0, 0, 'rats/', 'rats', 'png', 5 ); % writes first frame imwrite2( images(:,:,1:5), 1, 0, 'rats/', 'rats', 'png', 5 ); % writes first 5 frames images2 = imwrite2( [], 1, 0, 'rats/', 'rats', 'png', 5 ); % reads first 5 frames images2 = feval_images(@(x) x,{},'rats/','rats','png',0,4,5); % reads first 5 frames DATESTAMP 26-Jan-2005 2:00pm See also FEVAL_IMAGES, FEVAL_ARRAYS