Mercurial > hg > ltpda
view 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 |
line wrap: on
line source
function cmds = getBlockCommands(lines) % GETLINECOMMANDS get a set of commands from a set of simulink lines. % % M Hewitson 27-03-07 % disp(' + compiling line list'); cmds = []; for j=1:length(lines) l = lines(j); % get src block name srcblock = get(l, 'SrcBlockHandle'); sbname = get(srcblock, 'Name'); parent = get(srcblock, 'Parent'); % get src port number srcport = get(l, 'SrcPortHandle'); spn = get(srcport, 'PortNumber'); % Src variable path = strrep(get(srcblock, 'Path'), '/', '_'); svar = [sbname '_out_' num2str(spn)]; svar = [parent ' ' svar]; svar = sltpda_reduceVarName(svar); svar = sltpda_fixvar(svar); % get dst block name dstblock = get(l, 'DstBlockHandle'); for d=1:length(dstblock) dbname = get(dstblock(d), 'Name'); path = strrep(get(dstblock(d), 'Path'), '/', '_'); % get dst port number dstport = get(l, 'DstPortHandle'); dpn = get(dstport(d), 'PortNumber'); % Dst variable dvar = [dbname '_in_' num2str(dpn)]; dvar = [parent ' ' dvar]; dvar = sltpda_reduceVarName(dvar); dvar = sltpda_fixvar(dvar); cmd = [dvar ' = ' svar ';']; % store info info.fcn = ''; info.params = []; info.plist = plist(); info.ins = cellstr(svar); info.outs = cellstr(dvar); info.outsUsed = []; info.cmd = cmd; info.name = get(l, 'Name'); info.handle = get(l, 'Handle'); info.ranges = []; cmds = [cmds info]; end end