Extracting information from matrix using data from a vector
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!