更新时间:2022-04-20 21:10:16
假设您要选择A(1:2,2:3)
:
% Row and column indexes
rind = 1:2;
cind = 2:3;
pos = bsxfun(@plus,rind', size(A,2)*(cind-1));
pos =
6 11
7 12
您可能希望将其重塑为列向量pos(:)
,或者在一行中调用reshape()
.
You might want to reshape it into a column vector pos(:)
, or in one line with a call to reshape()
.