Effacer les filtres
Effacer les filtres

Extracting information from matrix using data from a vector

1 vue (au cours des 30 derniers jours)
Mark
Mark le 12 Mar 2013
I'm starting to realize that matlab may have been a bit much for my programming capabilities at this juncture. I'm close, just a few more questions.
I have a Vector R2 = [4;6] and I also have a large matrix K_structure. How do I extract values from the K_structure matrix corresponding with the values stored in vector R2? I'd like a new matrix K_small:
K_small(1,1) = K_structure(R2(1,1),R2(1,1))
K_small(1,2) = K_structure(R2(1,1),R2(2,1))
K_small(2,1) = K_structure(R2(2,1),R2(1,1))
K_small(2,2) = K_structure(R2(2,1),R2(2,1))
*Note R2 is not a fixed length and could be longer which would mean the K_small matrix would also grow, but always be square. i.e. if the length of R2 were 3 then the K_small matrix would then be 3x3.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by