% amrun-link.m - script to executed MATLAB scripts from makefile
% RMM, 25 Jul 06
%
% This script is called by make to run MATLAB scripts that are used to
% generate plots for printing.  This file should be called from a
% directory such that the path '../../matlab' points to the location
% of the AM MATLAB library.

function amrun(command)

% Check to see if path already includes AM matlab dir
if exist('amsetup') ~= 2
  if (exist('../../matlab/amsetup.m'))
    addpath('../../matlab');		% add path to AM commands
  elseif (exist('../matlab/amsetup.m'))
    addpath('../matlab');
  end
  if (exist('amsetup') == 2)
    evalin('base', 'amsetup');		% initialize global variables
  else
    fprintf(1, 'Warning: cannot find path to amsetup\n');
  end
end

global AMPRINT_FLAG; AMPRINT_FLAG = 1;
evalin('base', command);
quit;

