How to automatically pull values from matrix and set as variables
Afficher commentaires plus anciens
I have a matrix ex.
A=[11,7,3;9,13,5],
and I want to have a series of variables where
c1=1
c2=7
c3=3
c4=9
c5=13
c6=5.
How can I do an operation like this for any size matrix and note it is important that they are numbered in a certain direction. This is so in a later operation I can input c5 in an equation and it be the value located in A(2,2).
5 commentaires
dpb
le 2 Août 2017
While it is doable; this is almost certainly NOT the way to code whatever it is you have in mind.
Show us the next step of how you intend to use these variables and better solutions will undoubtedly come forth.
Walter Roberson
le 2 Août 2017
You do not need to assign them to variables for this. You can input as a string and analyze the string, pick out the index numbers the user entered and transform them into indices in the original matrix.
Garrett
le 2 Août 2017
Garrett
le 2 Août 2017
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!