%% Convert Function Handle to Character Vector
% Create function handles for both the cos function and for an anonymous function, and then convert them to character vectors.

fh = @cos;
c = func2str(fh)

%

fh = @(x,y)sqrt(x.^2+y.^2);
c = func2str(fh);

disp(['Anonymous function: ' c])

% Copyright 2012 The MathWorks, Inc.