www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/EvaluateFunctionUsingFunctionNameStringExample.m

    %% Evaluate Function with Function Name as Character Vector
% Round the value of |pi| to the nearest integer using the name of the
% function.
fun = 'round';
x1 = pi;
y = feval(fun,x1)
%%
% Round the value of |pi| to two digits to the right of the decimal point.
x2 = 2;
y = feval(fun,x1,x2)