Mercurial > hg > ltpda
diff m-toolbox/sltpda/sltpda_cmds2m.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/sltpda/sltpda_cmds2m.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,44 @@ +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 \ No newline at end of file