Mercurial > hg > ltpda
comparison m-toolbox/sltpda/getLineCommands.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 = getBlockCommands(lines) | |
2 | |
3 % GETLINECOMMANDS get a set of commands from a set of simulink lines. | |
4 % | |
5 % M Hewitson 27-03-07 | |
6 % | |
7 | |
8 disp(' + compiling line list'); | |
9 | |
10 cmds = []; | |
11 | |
12 for j=1:length(lines) | |
13 | |
14 l = lines(j); | |
15 | |
16 % get src block name | |
17 srcblock = get(l, 'SrcBlockHandle'); | |
18 | |
19 sbname = get(srcblock, 'Name'); | |
20 parent = get(srcblock, 'Parent'); | |
21 | |
22 % get src port number | |
23 srcport = get(l, 'SrcPortHandle'); | |
24 spn = get(srcport, 'PortNumber'); | |
25 % Src variable | |
26 path = strrep(get(srcblock, 'Path'), '/', '_'); | |
27 svar = [sbname '_out_' num2str(spn)]; | |
28 svar = [parent ' ' svar]; | |
29 svar = sltpda_reduceVarName(svar); | |
30 svar = sltpda_fixvar(svar); | |
31 | |
32 % get dst block name | |
33 dstblock = get(l, 'DstBlockHandle'); | |
34 for d=1:length(dstblock) | |
35 | |
36 dbname = get(dstblock(d), 'Name'); | |
37 | |
38 path = strrep(get(dstblock(d), 'Path'), '/', '_'); | |
39 % get dst port number | |
40 dstport = get(l, 'DstPortHandle'); | |
41 dpn = get(dstport(d), 'PortNumber'); | |
42 | |
43 % Dst variable | |
44 dvar = [dbname '_in_' num2str(dpn)]; | |
45 dvar = [parent ' ' dvar]; | |
46 dvar = sltpda_reduceVarName(dvar); | |
47 dvar = sltpda_fixvar(dvar); | |
48 | |
49 cmd = [dvar ' = ' svar ';']; | |
50 | |
51 % store info | |
52 info.fcn = ''; | |
53 info.params = []; | |
54 info.plist = plist(); | |
55 info.ins = cellstr(svar); | |
56 info.outs = cellstr(dvar); | |
57 info.outsUsed = []; | |
58 info.cmd = cmd; | |
59 info.name = get(l, 'Name'); | |
60 info.handle = get(l, 'Handle'); | |
61 info.ranges = []; | |
62 | |
63 cmds = [cmds info]; | |
64 end | |
65 end | |
66 |