【发布时间】:2014-03-19 11:55:17
【问题描述】:
在 Python numpy 中,可以使用索引数组,如(取自教程):
data = array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
i = array( [ [0,1], # indices for the first dim of data
[1,2] ] )
j = array( [ [2,1], # indices for the second dim
[3,3] ] )
现在,调用
data[i,j]
返回数组
array([[ 2, 5],
[ 7, 11]])
如何在 Matlab 中获得相同的结果?
【问题讨论】: