function rw = writer(fh,matout); % rw=write(fh,matout) Writes rw rows of matout to file specified by fh which % is a Gauss data set either opened for append using openfa( ) or % using the Gauss create command global gaussfh; % gauss file handle info if cols(matout) ~= gaussfh(fh,1); 'error columns of passed matrix do not correspond to columns of'; 'gauss file handle'; end; status=fseek(fh,0,1); % move file ptr to eof netr=rows(matout)*cols(matout); % number of elements to write if gaussfh(fh,2)==1; precstr='uchar'; % assume unsigned character elseif gaussfh(fh,2)==2; precstr='uint16'; % assumed unsigned integer 16 bit elseif gaussfh(fh,2)==4; precstr='float32' % assume 32 bit floating elseif gaussfh(fh,2)==8; precstr='float64' % assume 64 bit floating end; rw=fwrite(fh,matout',precstr); rw=rw/cols(matout); % since we want rows written return;