Disable solve function warnings

6 Ansichten (letzte 30 Tage)
Hassan Alhobail
Hassan Alhobail am 9 Mär. 2018
Kommentiert: Hassan Alhobail am 9 Mär. 2018
I'm using the solve function in my program and every time I run it I get I get this whole text of warnings:
Warning: Support of character vectors that are not valid variable names or define a number will be removed in a
future release. To create symbolic expressions, first create symbolic variables and then use operations on them.
...
This is my program:
e1 = 'v1 = (10+v2+v3+0)/4';
e2 = 'v2 = (v1 + 10 + 0 + v4)/4';
e3 = 'v3 = (0+v1+v4+0)/4';
e4 = 'v4 = (v2+v3+0+0)/4';
s = solve(e1,e2,e3,e4);
Is there a way to simply ignore this warning in matlab?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 9 Mär. 2018
Bearbeitet: Walter Roberson am 9 Mär. 2018
"Is there a way to simply ignore this warning in matlab?"
warning('off', 'symbolic:sym:sym:DeprecateExpressions')
but better is just to rewrite to follow the suggestions
syms v1 v2 v3 v4
e1 = v1 == (10+v2+v3+0)/4;
e2 = v2 == (v1 + 10 + 0 + v4)/4;
e3 = v3 == (0+v1+v4+0)/4;
e4 = v4 == (v2+v3+0+0)/4;
s = solve(e1,e2,e3,e4);
My understanding is that they are pretty serious about turning off the feature you are using.
  1 Kommentar
Hassan Alhobail
Hassan Alhobail am 9 Mär. 2018
Thank you. This was the method I learned, but I don't mind rewriting it with the way you suggested.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by