I have a MATLAB function that takes a function handle as an argument, and I need to extract the x and y values from it. The function handle is in the format of @(P) (subs(P, x, <x_value>) == <y_value>)
.
For example, if the function is called with the argument @(P) (subs(P, x, 2) == 0)
, I need to extract x = 2
and y = 0
. Similarly, if the function is called with the argument @(P) (subs(P, x, 6) == 0)
, I need to extract x = 6
and y = 0
.
How can I achieve this in MATLAB? I’m looking for a way to extract the x and y values from the function handle.
Example inputs:
@(P) (subs(P, x, 2) == 0)
@(P) (subs(P, x, 6) == 0)
Desired output:
- For the first input,
x = 2
andy = 0
- For the second input,
x = 6
andy = 0
I’m open to using any approach that can help me extract the x and y values from the function handle.