function v = vectorize(s)
%VECTORIZE Vectorize expression.
%   VECTORIZE(S), when S is a string expression, inserts a '.' before
%   any '^', '*' or '/' in S.  The result is a character string.
%
%   VECTORIZE(FCN), when FCN is an INLINE function object, vectorizes the
%   formula for FCN.  The result is the vectorized version of the INLINE
%   function.
%
%   See also INLINE/FORMULA, INLINE.

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.7 $  $Date: 2000/06/02 00:11:26 $

v = char(s);
for k = fliplr(find((v=='^') | (v=='*') | (v=='/')))
   v = [v(1:k-1) '.' v(k:end)];
end
v(findstr(v,'..')) = []; % Remove any possible ..*, ../, etc.
