How can I convert string text to Symbolics

1 view (last 30 days)
Amber
Amber on 16 Jun 2015
Commented: Walter Roberson on 17 Jun 2015
I use symbolic formula and file reading. I want read text from file and convert symbolic string to symbolics
syms x1
strX1 = 'x1';
x1 = 34;
disp(strX1)
disp (x1)
I want result of last 2 line to be same. Are there any way to make strX1 to convert as symbolic type? something like str2sym :D

Answers (1)

Walter Roberson
Walter Roberson on 16 Jun 2015
sym(strX1)
  2 Comments
Amber
Amber on 17 Jun 2015
Edited: Amber on 17 Jun 2015
Thnak you for answer but result is still x1 34
syms x1
strX1 = 'x1';
x2=sym(strX1);
x1 = 34;
disp(x2)
disp (x1)
What I have made wrong to make result show as 34 34?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!