2017-02-22 107 views
0

我有一個大小爲20x500x68的3D矩陣A。我有兩個矢量攜帶關於此矩陣信息分別是:
B(含零和一)尺寸1x68的和
C的大小(包含數字從1至3)1x68
(長度都BC對應於第三維A)。陣列中的值的子矩陣/矢量隊列

我想創建一個「子矩陣」A只有第三維,其中B==1C==3

示意:

[sub matrix of A] = A (B = 1, C = 3) 

有沒有辦法做到這一點沒有一個循環?

回答

0
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