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

4 ビュー (過去 30 日間)
Swapnali Gujar
Swapnali Gujar 2014 年 3 月 28 日
コメント済み: Walter Roberson 2014 年 3 月 28 日
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?

回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 3 月 28 日
str2func() or inline()
  2 件のコメント
Swapnali Gujar
Swapnali Gujar 2014 年 3 月 28 日
inline() works, but that is also not allowed by Cody. str2func() doesnt work
Walter Roberson
Walter Roberson 2014 年 3 月 28 日
matlabFunction(sym(f))
matlabFunction automatically vectorizes.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by