Convert a string into a function of x
66 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I have created a string like this:
Sstr = join(compose('(x(%d:%d)-x(%d:%d))))', A), ' + ')
so I get a result:
Sstr='(x(2:180)-x(1:179)+(x(182:360)-x(181:359))'
Is it possible to convert the string into a function of x like this??:
f=@(x) (x(2:180)-x(1:179)+(x(182:360)-x(181:359))
thanks
Nikolas
採用された回答
その他の回答 (1 件)
KRISHNA MAHTO
2023 年 1 月 12 日
編集済み: KRISHNA MAHTO
2023 年 1 月 12 日
i have taken string as an input form the user ,, and want data to be converted into funtion of x and y , by the program itself ,,,for easy usage ,
%code to take input form the user -
prompt = "input U:-"
u = input(prompt,"s")
prompt = "input V:-"
v = input(prompt ,"s")
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!