
function names = am_dep(pathstr,varargin)
% AM_DEP Examines the dependencies of the comm toolbox
%   am_dep(pathstr,varargin)
%
%   Example for current lab
%         am_dep('comm','amod','ademod')

% ------- am_dep.m -----------------------------------------
% Marios Athineos, marios@ee.columbia.edu
% http://www.ee.columbia.edu/~marios/
% Copyright (c) 2003 by Columbia University.
% All rights reserved.
% ----------------------------------------------------------

% Initialize the names var
names = [];

% This works for an arbitrary number of m-files
len = length(varargin);
for I = 1:len
    % Get the dependencies
    list  = depfun(varargin{I});
    
    % We know from the MATLAB web site that COMM toolbox only depends on the SP
    % toolbox, which we have so we only need to find the COMM dependencies
    start = regexpi(list,pathstr);
    
    % Find the indices where we have a match
    idx   = cellfun('isempty',start);
    
    % Get the actual names
    tmp   = list(find(~idx));
    
    % And keep only the unique ones
    names  = union(names,tmp);
end

%for I=1:length(names);
%    open(names{I});
%end