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 images are written to: imagename1 = [path name int2str2(i,ndigits) '.' ext]; imagename2 = [path name int2str2(i+1,ndigits) '.' ext]; ... 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 images multflag - set to 1 if I represents a stack of images i - 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 EXAMPLE load images; 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 DATESTAMP 29-Sep-2005 2:00pm See also FEVAL_IMAGES, FEVAL_ARRAYS, INT2STR2