Mercurial > hg > ishara
view general/fileutils/tofile.m @ 54:9bcf5e133bf0
Added from old stats library.
author | samer |
---|---|
date | Mon, 23 Feb 2015 16:08:09 +0000 |
parents | e44f49929e56 |
children |
line wrap: on
line source
function tofile(outfile,varargin) % tofile - Run functions that need a file handle to write output % % tofile :: % path ~'file name to write to', % (fid -> action unit) ~'action taking file handle', % (fid -> action unit) ~'action taking file handle', % ... % -> action unit. % % Opens the given file in APPEND mode, then calls each function % passing the file handle to each. fh=fopen(outfile,'a'); fprintf(fh,'\n%% --- New session ---\n\n'); for i=1:length(varargin) fprintf(fh,'\n%% --- Running %s\n\n', func2str(varargin{i})); feval(varargin{i},fh); end fclose(fh);