Use entries of symbolic array outside of the array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Tobias Ohrmann
am 28 Mär. 2020
Kommentiert: Tobias Ohrmann
am 28 Mär. 2020
I have defined a matrix of symbolic variables via
X=sym(x,[8,24]);
When I now type x5_24 for instance, MATLAB still says "Unrecognized function or variable x5_24". Why? I need to use the variable entries outside of the matrix X.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 28 Mär. 2020
The reason is that the elements of ‘X’ are stored as matrix elements. The individual elements exist only as matrix elements, not as individual, named variables:
syms x
X=sym('x',[8,24]);
Q = X(5,24)
produces:
Q =
x5_24
3 Kommentare
Ameer Hamza
am 28 Mär. 2020
Read here why it is a bad idea: https://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer. Is there a reason that you cannot use matrix indexing to access an element?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Number Theory 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!