Getting a Symbolic Variable from the user using input

How to get a Symbolic variable as an input from the user? for example when the input prompt comes up if the user inputs nothing or a '?' sign, a symbolic variable automatically gets created. I tried using the code below and then entering something like "syms u" to create the variable but it gives this error: Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
Fx=input('Horizental Force on Node');

 採用された回答

madhan ravi
madhan ravi 2018 年 10 月 19 日
編集済み: madhan ravi 2018 年 10 月 19 日

0 投票

"How to get a Symbolic variable as an input from the user?"
prompt = 'Horizontal force on node: ';
str = input(prompt,'s');

3 件のコメント

madhan ravi
madhan ravi 2018 年 10 月 19 日
The above will do the work you need.
Morteza Ghafoori
Morteza Ghafoori 2018 年 10 月 19 日
With this, an empty symbolic variable will be created if the user inputs nothing and that totally suits me. Thanks
madhan ravi
madhan ravi 2018 年 10 月 19 日
you are welcome

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by