view 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
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);