interesting matrix indexing question without for loops
이전 댓글 표시
size(matrixA)=[b,n,m]
size(matrixB)=[n,m]
how can I create
matrixC(i,j)=matrixA(matrixB(i,j),i,j)
without using for-loops? What is this kind of indexing called? Thanks!
채택된 답변
추가 답변 (1개)
Bruno Luong
2018년 10월 3일
편집: Bruno Luong
2018년 10월 3일
C = A(B+reshape(0:numel(B)-1,size(B))*size(A,1))
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!