string to sym error

1 visualización (últimos 30 días)
Alberto Carlos
Alberto Carlos el 19 de Sept. de 2016
Comentada: Karan Gill el 25 de Oct. de 2016
I have the string
>> d='1/m'
>> class(d)
char
>> p=sym(d)
I get:
Warning: Support of strings that are not valid variable names or define a number will be removed in a future relase. To create symbolic expressions, firs create symbolic variables and then use operations on them.
after that p is empty
I tried syms m; at the beginning but i get the same error

Respuesta aceptada

Mischa Kim
Mischa Kim el 19 de Sept. de 2016
Alberto, the functionality you are using will be removed in future releases, but you can still use it. That is why you are getting a warning message (not an error message).
Instead use,
syms m
p = 1/m
  2 comentarios
Richard Wang
Richard Wang el 24 de Oct. de 2016
but if I do need to convert a string to symbolic expression, how can I realize it, since this sym() function will no longer in use?
For example, I want to type in an expression by keyboard input and I want to treat this expression as symbolic function or other.
Karan Gill
Karan Gill el 25 de Oct. de 2016
You can use "eval" on the string input.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Symbolic Variables, Expressions, Functions, and Preferences en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by