view m-toolbox/sltpda/sltpda_verify_model.m @ 7:1e91f84a4be8 database-connection-manager

Make ltpda_up.retrieve work with java.sql.Connection objects
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

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