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

Stephen23
Stephen23 2019년 11월 27일
편집: Stephen23 2019년 11월 27일
@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?

댓글을 달려면 로그인하십시오.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2019년 11월 27일

0 개 추천

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

댓글 수: 3

adem ski
adem ski 2019년 11월 27일
i want use eval
Fangjun Jiang
Fangjun Jiang 2019년 11월 27일
편집: Fangjun Jiang 2019년 11월 27일
str='1/(sqrt(x^2+y^2))';
eval(str)
Guillaume
Guillaume 2019년 11월 27일
"i want use eval"
Why? It's the one function that beginners should never use.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Function Creation에 대해 자세히 알아보기

질문:

2019년 11월 27일

편집:

2019년 11월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by