str2func operation

8 ビュー (過去 30 日間)
Grace Lavelle
Grace Lavelle 2019 年 11 月 14 日
回答済み: JESUS DAVID ARIZA ROYETH 2019 年 11 月 14 日
Everytime I try to run this operation, it tells me the expression is incomplete but I can't see whats wrong with it.
str1 = input ( 'type an expression that is a function of"y"');
tmp1 = str2func(['@(y,t) ', str1]);

回答 (1 件)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019 年 11 月 14 日
type an expression that is a function of"y"'5*y+5'
here there is no problem, remember the expression goes in single quotes, if you want to save the quotes then change your code for this :
str1 = input ( 'type an expression that is a function of"y"','s');
tmp1 = str2func(['@(y,t) ', str1]);
type an expression that is a function of"y"5*y+5

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by