annotate general/fileutils/tofile.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents e44f49929e56
children
rev   line source
samer@4 1 function tofile(outfile,varargin)
samer@4 2 % tofile - Run functions that need a file handle to write output
samer@4 3 %
samer@4 4 % tofile ::
samer@4 5 % path ~'file name to write to',
samer@4 6 % (fid -> action unit) ~'action taking file handle',
samer@4 7 % (fid -> action unit) ~'action taking file handle',
samer@4 8 % ...
samer@4 9 % -> action unit.
samer@4 10 %
samer@4 11 % Opens the given file in APPEND mode, then calls each function
samer@4 12 % passing the file handle to each.
samer@4 13
samer@4 14
samer@4 15 fh=fopen(outfile,'a');
samer@4 16
samer@4 17 fprintf(fh,'\n%% --- New session ---\n\n');
samer@4 18
samer@4 19 for i=1:length(varargin)
samer@4 20 fprintf(fh,'\n%% --- Running %s\n\n', func2str(varargin{i}));
samer@4 21 feval(varargin{i},fh);
samer@4 22 end
samer@4 23
samer@4 24 fclose(fh);