Mercurial > hg > ltpda
comparison m-toolbox/sltpda/sltpda_parse_model.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 cmds = sltpda_parse_model(mdlfile) | |
2 | |
3 % SLTPDA_PARSE_MODEL Parse an sLTPDA model file and produce a runable m-file. | |
4 % | |
5 % M Hewitson 27-03-07 | |
6 % | |
7 % $Id: sltpda_parse_model.m,v 1.4 2007/05/06 12:17:38 hewitson Exp $ | |
8 % | |
9 | |
10 | |
11 banner = sprintf('=========== parsing ''%s'' ===========', mdlfile); | |
12 disp(banner); | |
13 disp(' '); | |
14 | |
15 % load the model into memory | |
16 load_system(mdlfile); | |
17 | |
18 % parse model elements | |
19 sys = get_param(mdlfile, 'Handle'); | |
20 blocks = find_system(sys, 'FindAll', 'on', 'type', 'block'); | |
21 lines = find_system(sys, 'FindAll', 'on', 'type', 'line'); | |
22 oblocks = find_system(sys, 'FindAll', 'on', 'BlockType', 'Outport'); | |
23 iblocks = find_system(sys, 'FindAll', 'on', 'BlockType', 'Inport'); | |
24 ioblocks = [iblocks;oblocks]; | |
25 | |
26 % compile commands | |
27 vcmds = getVarBlockCommands(blocks); | |
28 bcmds = getBlockCommands(blocks); | |
29 lcmds = getLineCommands(lines); | |
30 iocmds = getIOblockCommands(ioblocks); | |
31 cmds = [bcmds lcmds iocmds]; | |
32 | |
33 % go through commands and make list of commands | |
34 % in order required to execute | |
35 | |
36 %-------- now sort the commands | |
37 % % | |
38 % for j=1:length(cmds) | |
39 % disp(cmds(j)) | |
40 % end | |
41 | |
42 cmds = [vcmds cmds]; | |
43 cmds = sortCmds(cmds); | |
44 | |
45 % | |
46 % for j=1:length(cmds) | |
47 % disp(cmds(j)) | |
48 % end | |
49 | |
50 | |
51 bannerEnd = []; | |
52 while length(bannerEnd) < length(banner) | |
53 bannerEnd = [bannerEnd '=']; | |
54 end | |
55 disp(' '); | |
56 disp(bannerEnd); | |
57 | |
58 disp(' ') |