私は1000x1の配列を持っており、ラムダ値lam_packetに基づいて等しい部分に分割し、各部分で0 0 0 0をラドムのバイナリ値に置き換えますが、この関数を呼び出すと、エラー
??? Error using ==> bsxfun
Non-singleton dimensions of the two input arrays must match each other.
Error in ==> imputation at 11
idx = bsxfun(@plus, idx', (0:3));
どんな助けでも大歓迎です。
function [ xxx ] = imputation(x,lam_packet,noframes)
x1=x(:,1:-1:1).';
for i=1:lam_packet:noframes
%# starting locations of four-consecutive zeros
idx= strfind(x1(i), [0 0 0 0]);
%# random binary numbers (rows) used to replace the consecutive zeros
n = dec2bin(randi([0 8],[numel(idx) 1]),4) - '0';
%# linear indices corresponding to the consecutive-zeros
idx = bsxfun(@plus, idx', (0:3));
%'# replace the 4-zeros
xx = x1;
xx(idx(:)) = n(:);
end
xxx = xx(1:-1:1,:).';
end
enter code here