eval and inline function

clc
clear all
close all
a=0;
b=2;
y=5;
x=1/2;
f3=inline('1/(sqrt(x^2+y^2)');
[f6]=eval(f2)
??? Undefined function or method 'eval' for input arguments of type 'inline'.

1 Comment

Stephen23
Stephen23 on 27 Nov 2019
Edited: Stephen23 on 27 Nov 2019
@adem ski: why on earth are you using outdated and almost obsolete inline?
The very start of the inline documentation states
Why are you ignoring the advice of the MATLAB documentation? Your task would be trivial with an anonymous function, do you have a good reason why you cannot use one?
Why on earth do you want to use awful, anti-pattern eval?

Sign in to comment.

Answers (1)

f3=inline('1/(sqrt(x^2+y^2))');
x=1/2;
y=5;
f3(x,y)

3 Comments

i want use eval
str='1/(sqrt(x^2+y^2))';
eval(str)
"i want use eval"
Why? It's the one function that beginners should never use.

Sign in to comment.

Categories

Find more on Function Creation in Help Center and File Exchange

Asked:

on 27 Nov 2019

Edited:

on 27 Nov 2019

Community Treasure Hunt

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

Start Hunting!