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(FUN), when FUN is an INLINE function object, vectorizes the
% formula for FUN. The result is the vectorized version of the INLINE
% function.
%
% See also INLINE/FORMULA, INLINE.
% Modified vectorize function
% Authors:
% Jorge Paloschi (jpalosch@mathworks.com)
% Sri Krishnamurthy(skrishna@mathworks.com)
% Copyright 2011 MathWorks, Inc.
v = char(s);
if isempty(v)==1
v = [];
else
v = strrep(v,'^','.^');
v = strrep(v,'*','.*');
v = strrep(v,'/','./');
end
v(findstr(v,'..')) = []; % Remove any possible ..*, ../, etc.