%--------------------------------------------------- % Simple example script showing a use for the Matlab % function eval(). %--------------------------------------------------- funs = char('ceil', 'floor', 'fix', 'round'); x = 3.418; numfuns = size(funs, 1); for k = 1:numfuns current_fun = deblank(funs(k,:)); disp(['Evaluating ' current_fun]); str = [current_fun '(x)']; eval(str) end