comparison m-toolbox/sltpda/sltpda_verify_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 result = sltpda_verify_model(mdlfile)
2
3 % SLTPDA_VERIFY_MODEL verifies that the given model file only contains
4 % sLTPDA compatible blocks.
5 %
6 % usage: result = sltpda_verify_model(mdlfile)
7 %
8 % result: 0 = failed, 1 = passed
9 %
10 % M Hewitson 28-03-07
11 %
12 % $Id: sltpda_verify_model.m,v 1.2 2007/04/25 09:06:08 hewitson Exp $
13 %
14
15
16 banner = sprintf('=========== verifying ''%s'' ===========', mdlfile);
17 disp(banner);
18 disp(' ');
19
20 result = 1;
21
22 % load the model into memory
23 load_system(mdlfile);
24
25 % get list of blocks
26 sys = get_param(mdlfile, 'Handle');
27 blocks = find_system(sys, 'FindAll', 'on', 'type', 'block');
28 bcmds = getBlockCommands(blocks);
29
30 % check each block
31 for j=1:length(bcmds)
32 if ~isValidBlock(bcmds(j).fcn)
33 result = 0;
34 end
35 end
36
37 if result == 0
38 error(['### model ' mdlfile ' contains invalid blocks.']);
39 end
40 bannerEnd = [];
41 while length(bannerEnd) < length(banner)
42 bannerEnd = [bannerEnd '='];
43 end
44 disp(' ');
45 disp(bannerEnd);
46
47 disp(' ')
48
49
50
51 % END