Alternative to 'eval', 'evalc','feval' etc functions in the Cody solutions

3 visualizaciones (últimos 30 días)
Swapnali Gujar
Swapnali Gujar el 28 de Mzo. de 2014
Comentada: Walter Roberson el 28 de Mzo. de 2014
Why cody does not allow 'eval', 'evalc','feval' etc functions in the solutions? What is alternative to these functions?
e.g. I need to use:
if f='3*x'
x=0:10;
y=eval(vectorise(f))
so that values of y can be calculated as 3.*x
bt cody does not let us to use functions like eval
What is the alternative?

Respuestas (1)

Walter Roberson
Walter Roberson el 28 de Mzo. de 2014
str2func() or inline()
  2 comentarios
Swapnali Gujar
Swapnali Gujar el 28 de Mzo. de 2014
inline() works, but that is also not allowed by Cody. str2func() doesnt work
Walter Roberson
Walter Roberson el 28 de Mzo. de 2014
matlabFunction(sym(f))
matlabFunction automatically vectorizes.

Iniciar sesión para comentar.

Categorías

Más información sobre Function Creation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by