function r = collect(s,x)
%COLLECT Collect coefficients.
%   COLLECT(S,v) regards each element of the symbolic matrix S as a
%   polynomial in v and rewrites S in terms of the powers of v.
%   COLLECT(S) uses the default variable determined by FINDSYM.
%
%   Examples:
%      collect(x^2*y + y*x - x^2 - 2*x)   returns   (y-1)*x^2+(y-2)*x
%
%      f = -1/4*x*exp(-2*x)+3/16*exp(-2*x)
%      collect(f,exp(-2*x))   returns   (-1/4*x+3/16)*exp(-2*x)
%
%   See also SIMPLIFY, SIMPLE, FACTOR, EXPAND, FINDSYM.

%   Copyright (c) 1993-98 by The MathWorks, Inc.
%   $Revision: 1.11 $  $Date: 1997/11/29 01:05:21 $

if nargin == 1
   x = findsym(s,1);
end
r = maple('map','collect',sym(s),sym(x));
