function sltpda_run_model(mdlfile)

% SLTPDA_RUN_MODEL verifies, builds, and runs an sLTPDA model
% 
% usage: sltpda_run_model(mdlfile)
% 
% M Hewitson 28-03-07
% 
% $Id: sltpda_run_model.m,v 1.1 2007/03/30 08:24:36 hewitson Exp $
% 

% get m filename from mdl file
[path,name,ext, vers] = fileparts(mdlfile);
mfile = [fullfile(path, name) '_mfile'];

if sltpda_verify_model(mdlfile)
  
  % parse model file
  cmds = sltpda_parse_model(mdlfile);
  % evaluate each command
  h  = waitbar(0,'Executing pipeline...');
  nc = length(cmds);
  for j=1:nc
    disp(['== executing: ' cmds(j).cmd]);
    eval(cmds(j).cmd);
    waitbar(j/nc,h)
  end
  delete(h);
end

% END