How to convert or extract symbolic matrix expressions to string?
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lee Jong Hyun
am 1 Aug. 2023
Beantwortet: Anjaneyulu Bairi
am 28 Aug. 2023
For symbolic matrix expression of symbolic matrix 'D', I want to convert or extract any variable type with char and str.
How to convert or extract symbolic matrix expressions to string?
Thank you.
N = 100;
A = symmatrix('A',[N, N]);
B = symmatrix('B',[N, N]);
C = symmatrix('C',[N, N]);
D = A*B*C;
2 Kommentare
Dyuman Joshi
am 1 Aug. 2023
It might be difficult with symmatrix or maybe not even possible.
This might be a workaround -
N = 3;
syms A B C [N N]
D = A*B*C
E = string(D)
E(1)
Akzeptierte Antwort
Anjaneyulu Bairi
am 28 Aug. 2023
I understand that you are trying to convert symbolic matrix expression into string.
You can use “string” function to convert it.
To avoid error while converting to string, please use “syms” like below instead of “symmatrix” to create symbolic matrix.
N=100
S = sym('S', [N N])
S_str=string(S)
“S_str” is the string form of “S” symbolic expression.
Hope it helps!
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Variables, Expressions, Functions, and Preferences 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!