how to convert text into expression

I have a text file which has string say as (50%((15000-a)+b)). is there any way to calculate this expression.

1 comentario

Stephen23
Stephen23 el 19 de Ag. de 2016
Editada: Stephen23 el 19 de Ag. de 2016
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.

Iniciar sesión para comentar.

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 19 de Ag. de 2016
Editada: Stephen23 el 19 de Ag. de 2016

0 votos

It seems that you are looking for functions such eval, which in fact is not recommended by forums and also by Matlab help. read

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 19 de Ag. de 2016

Editada:

el 19 de Ag. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by