view m-toolbox/sltpda/sltpda_cmds2m.m @ 29:54f14716c721 database-connection-manager

Update Java code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

function sltpda_cmds2m(mdlfile, cmds, mfile)

% SLTPDA_CMDS2M write a runable m-file from the given command list.
% 
% usage: sltpda_cmds2m(mdlfile, cmds, mfile)
% 
% M Hewitson 27-03-07
% 


ALGONAME = mfilename;
VERSION  = '$Id: sltpda_cmds2m.m,v 1.1 2007/03/30 08:24:36 hewitson Exp $';



[path,name,ext,vers] = fileparts(mfile);
if isempty(ext)
  mfile = [mfile '.m'];
end


% write m file
fd = fopen(mfile, 'w+');

fprintf(fd, '%% %s \n', upper(mfile));
fprintf(fd, '%% \n');
fprintf(fd, '%% written by %s / %s\n', ALGONAME, VERSION);
fprintf(fd, '%%   on %s\n', sprintf('%s', datestr(now)));
fprintf(fd, '%% \n');
fprintf(fd, '%% based on mdl file: %s\n', mdlfile);
fprintf(fd, '%% \n');
fprintf(fd, '%% \n');
fprintf(fd, ' \n');
fprintf(fd, 'clear; \n');
for c=1:length(cmds)
  fprintf(fd, '%s\n', cmds(c).cmd);
end
fprintf(fd, ' \n');
fprintf(fd, ' \n');
fprintf(fd, '%% END\n');
fclose(fd);


% END