diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/sltpda/sltpda_verify_model.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,51 @@
+function result = sltpda_verify_model(mdlfile)
+
+% SLTPDA_VERIFY_MODEL verifies that the given model file only contains
+% sLTPDA compatible blocks.
+% 
+% usage: result = sltpda_verify_model(mdlfile)
+% 
+% result: 0 = failed, 1 = passed
+% 
+% M Hewitson 28-03-07
+% 
+% $Id: sltpda_verify_model.m,v 1.2 2007/04/25 09:06:08 hewitson Exp $
+% 
+
+
+banner = sprintf('===========     verifying ''%s''      ===========', mdlfile);
+disp(banner);
+disp(' ');
+
+result = 1;
+
+% load the model into memory
+load_system(mdlfile);
+
+% get list of blocks
+sys      = get_param(mdlfile, 'Handle');
+blocks   = find_system(sys, 'FindAll', 'on', 'type', 'block');
+bcmds    = getBlockCommands(blocks);
+
+% check each block
+for j=1:length(bcmds)
+  if ~isValidBlock(bcmds(j).fcn)
+    result = 0;
+  end
+end
+
+if result == 0
+  error(['### model ' mdlfile ' contains invalid blocks.']); 
+end
+bannerEnd = [];
+while length(bannerEnd) < length(banner)
+  bannerEnd = [bannerEnd '='];
+end
+disp(' ');
+disp(bannerEnd);
+
+disp(' ')
+
+
+
+% END
\ No newline at end of file