Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个矩阵,说
a = [1 2 3; 4 5 6]
和
b = [2 2 2; 3 3 3]
当我在 matlab 中做 a(b) 时,我得到的答案是
a(b) = [4 4 4; 2 2 2]
这里到底发生了什么?
您正在为 a 中的每个项目编制索引b。a(2) = 4和a(3) = 2
b
a(2) = 4
a(3) = 2
所以
c = [a(2) a(2) a(2); a(3) a(3) a(3)]
就是你所看到的。