arrays - Matlab bsxfun alternative cause wrong result -
i have run matlab code on old version doesn't support bsxfun , need write equivalent expression of
matx = bsxfun(@rdivide, matx, reshape(f, 1, 1, length(f))); i have tried this
matx=matx./ones(size(reshape(f, 1, 1, length(f)),1)); but wrong result
matx size 246x301x81 f size 1x81 before invocation of istruction use bsxfun
since matx 3d array , f row vector of length equal number of elements in dim-3 of matx, can perform bsxfun equivalent expansion/replication repmat , perform elementwise division -
% size of matx [m1,n1,r1] = size(matx); %// replicate f size of matx , perform elementwise division matx = matx./repmat(permute(f,[1 3 2]),[m1 n1 1])
Comments
Post a Comment