comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function sltpda_cmds2m(mdlfile, cmds, mfile)
2
3 % SLTPDA_CMDS2M write a runable m-file from the given command list.
4 %
5 % usage: sltpda_cmds2m(mdlfile, cmds, mfile)
6 %
7 % M Hewitson 27-03-07
8 %
9
10
11 ALGONAME = mfilename;
12 VERSION = '$Id: sltpda_cmds2m.m,v 1.1 2007/03/30 08:24:36 hewitson Exp $';
13
14
15
16 [path,name,ext,vers] = fileparts(mfile);
17 if isempty(ext)
18 mfile = [mfile '.m'];
19 end
20
21
22 % write m file
23 fd = fopen(mfile, 'w+');
24
25 fprintf(fd, '%% %s \n', upper(mfile));
26 fprintf(fd, '%% \n');
27 fprintf(fd, '%% written by %s / %s\n', ALGONAME, VERSION);
28 fprintf(fd, '%% on %s\n', sprintf('%s', datestr(now)));
29 fprintf(fd, '%% \n');
30 fprintf(fd, '%% based on mdl file: %s\n', mdlfile);
31 fprintf(fd, '%% \n');
32 fprintf(fd, '%% \n');
33 fprintf(fd, ' \n');
34 fprintf(fd, 'clear; \n');
35 for c=1:length(cmds)
36 fprintf(fd, '%s\n', cmds(c).cmd);
37 end
38 fprintf(fd, ' \n');
39 fprintf(fd, ' \n');
40 fprintf(fd, '%% END\n');
41 fclose(fd);
42
43
44 % END