I have an anonymous function, say
f=@(x,y) x+y;
I can name the function using func2str:
func2str(f)ans = '@(x,y)x+y'
What if I want to get the function name with different names for the anonymous variables x,y. Say replacing x,y with the strings 'Small', 'Large' to yield:
'@(Small,Large)Small+Large'
This becomes more tricky if the function has x or y also as non-variables. say for the case of f(x) x+'x', the correct answer will be '@(Small)Small+'x''
Best Answer