function [fn, fn2] = func_creator() A = [3 1 4 1 5 9]; fn = @(x) eval(x); fn2 = @() A; A = 'doom';