矩阵特定位置元素求和问题

参考:http://www.ilovematlab.cn/thread-554817-1-1.html

https://ww2.mathworks.cn/help/matlab/ref/sub2ind.html?searchHighlight=sub2ind&s_tid=doc_srchtitle

sub2ind(matrixSize,rowSub,colSub)行列索引转为单索引,然后求和,如sum(A(sub2ind(size(A),row,col)))

猜你喜欢

转载自blog.csdn.net/justforacm/article/details/82855229