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

1 visualizzazione (ultimi 30 giorni)
%% Test
syms x
eqn(x) = x^2
func = @(x) eqn
func(2)

Risposta accettata

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

Più risposte (1)

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

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by