If I use the
inline function in MATLAB I can create a single function name that could respond differently depending on previous choices:
p = inline('a - b','a','b');
p = inline('a + b','a','b');
c = p(1,2);
d = p(3,4);
But the inline functions I'm creating are becoming quite epic, so I'd like to change them to other types of functions (i.e. m-files, subfunctions, or nested functions).
Let's say I have m-files like
KavrayskiyVII.m, etc. (all taking a value for
lambda), and I'd like to assign the chosen function to
p in the same way as I have above so that I can call it many times (with variable sized matrices and things that make using
eval either impossible or a total mess).
I have a variable,
type, that will be one of the names of the functions required (e.g.
'KavrayskiyVII', etc.). I figure I need to make
p into a pointer to the function named inside the
type variable. Any ideas how I can do this?