Error using str2sym (line 213)

18 views (last 30 days)
Tiasa Ghosh
Tiasa Ghosh on 29 Aug 2018
Commented: madhan ravi on 30 Aug 2018
I receive an error while running the following section:
syms V I R fR L dI Ka I w
str2sym('V == I*(R+fR) + L*dI + Ka*I*w')
I get the error
Error using str2sym (line 213)
Unable to convert string to symbolic expression:
Error: Unexpected MATLAB expression.
After looking inside the error with dbstop if error, I found the variable 'I' is treated as special character. why so?
madhan ravi
madhan ravi on 30 Aug 2018
Cool good that you found an answer.:)

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 29 Aug 2018
This is a bug involving use of the variables I or J or 'Pi' or 'PI' or 'pI'. Also, you cannot use if in an expression, and i and j will be translated into 1i .
Those are the only one-character and two-character variable names that are affected.
  1 Comment
Tiasa Ghosh
Tiasa Ghosh on 30 Aug 2018
Thanks! :) I will keep these in mind.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by