how to convert text into expression

19 ビュー (過去 30 日間)
Ayushi Saxena
Ayushi Saxena 2016 年 8 月 19 日
編集済み: Stephen23 2016 年 8 月 19 日
I have a text file which has string say as (50%((15000-a)+b)). is there any way to calculate this expression.
  1 件のコメント
Stephen23
Stephen23 2016 年 8 月 19 日
編集済み: Stephen23 2016 年 8 月 19 日
Note that (50%((15000-a)+b) is not valid MATLAB syntax, and appears to be written in some other language: you would have to write a parser for whatever language that is. This is not a trivial task.

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

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 8 月 19 日
編集済み: Stephen23 2016 年 8 月 19 日
It seems that you are looking for functions such eval, which in fact is not recommended by forums and also by Matlab help. read

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by