view m-toolbox/sltpda/sltpda_parse_model.m @ 40:977eb37f31cb
database-connection-manager
User friendlier errors from utils.mysql.connect
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Mon, 05 Dec 2011 18:04:03 +0100 (2011-12-05) |
parents |
f0afece42f48 |
children |
|
line source
function cmds = sltpda_parse_model(mdlfile)
% SLTPDA_PARSE_MODEL Parse an sLTPDA model file and produce a runable m-file.
%
% M Hewitson 27-03-07
%
% $Id: sltpda_parse_model.m,v 1.4 2007/05/06 12:17:38 hewitson Exp $
%
banner = sprintf('=========== parsing ''%s'' ===========', mdlfile);
disp(banner);
disp(' ');
% load the model into memory
load_system(mdlfile);
% parse model elements
sys = get_param(mdlfile, 'Handle');
blocks = find_system(sys, 'FindAll', 'on', 'type', 'block');
lines = find_system(sys, 'FindAll', 'on', 'type', 'line');
oblocks = find_system(sys, 'FindAll', 'on', 'BlockType', 'Outport');
iblocks = find_system(sys, 'FindAll', 'on', 'BlockType', 'Inport');
ioblocks = [iblocks;oblocks];
% compile commands
vcmds = getVarBlockCommands(blocks);
bcmds = getBlockCommands(blocks);
lcmds = getLineCommands(lines);
iocmds = getIOblockCommands(ioblocks);
cmds = [bcmds lcmds iocmds];
% go through commands and make list of commands
% in order required to execute
%-------- now sort the commands
% %
% for j=1:length(cmds)
% disp(cmds(j))
% end
cmds = [vcmds cmds];
cmds = sortCmds(cmds);
%
% for j=1:length(cmds)
% disp(cmds(j))
% end
bannerEnd = [];
while length(bannerEnd) < length(banner)
bannerEnd = [bannerEnd '='];
end
disp(' ');
disp(bannerEnd);
disp(' ')