If I have an anonymous function in MATLAB, say
f = @(t) [t, t+5];
and I wanted to create a new anonymous function g that accesses the first index of f
, so that, in this example,
g = @(t) t;
how can I do so?
I have tried doing something along the lines of
g = @(t) f(t)(1);
but the compiler says that this is "invalid array indexing", even though I thought that this would basically allow g
to be g(t) = t