Reputation: 379
I have defined a function TEST=@(t)t.^2
in my program. However, in some situation, the TEST
is needed to be set to be a zero function. I write TEST2=@(t)0.*TEST
. Unfortunately, error occurs when I compute TEST2(1):
Undefined operator '.*' for input arguments of type 'function_handle'.
I would like to know any way to solve the problem
Upvotes: 0
Views: 40
Reputation: 4195
the error says it all. TEST
is a function handle, and multiplying a function handle by 0 is not defined. in order to convert the TEST
function handle in TEST2
definition into a numeric data just use it as a function and define its input:
TEST2=@(t)0.*TEST(t)
Upvotes: 1