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大小为 20x500x68 的 3D 矩阵。我有两个向量携带关于这个矩阵的信息,它们是:( B包含零和一)大小为 1x68 和 C(包含从 1 到 3 的数字)大小为 1x68 (长度都B对应C于 的第三维A)。
A
B
C
我想创建一个A只有第三维的“子矩阵”,其中B==1和C==3。
B==1
C==3
示意图:
[sub matrix of A] = A (B = 1, C = 3)
有没有办法在没有循环的情况下做到这一点?
SMA = A(:,:,B==1 & C==3) %This submatrix contains all rows and columns of that third dimension of A %where B equals 1 and C equals 3