Why can't a variable holding an equation be used to make a function handle?

1 view (last 30 days)
%% Test
syms x
eqn(x) = x^2
func = @(x) eqn
func(2)

Accepted Answer

madhan ravi
madhan ravi on 20 Feb 2020
I would simply use matlabFunction() as sir Walter says but maybe you have the follwing in mind:
func = @(x) eqn(x)

More Answers (1)

Walter Roberson
Walter Roberson on 20 Feb 2020
Use matlabFunction()

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!