If I use the inline
function in matlab I can create a single function name that could respond differently depending on previous choices:
if (sometimes)
p = inline('a - b','a','b');
else
p = inline('a + b','a','b');
end
c = p(1,2);
d = p(3,4);
But the inline functions I'm creating are becoming quite epic, so I'd like to move them to included function files instead of inline functions.
I have Mercator.m
, KavrayskiyVII.m
and a few others (all taking a value for phi
and 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 eval
impossible, I believe).
I have a variable, type
, that will be one of the names of the functions required (eg. 'Mercator', 'KavrayskiyVII'), I figure I need to make p
into a pointer to the function named inside the type
variable. Any ideas?