I have a 1000x1 array, in which i would like it to divide into equal parts based on a lambda value lam_packet, and then in each part i would replace 0 0 0 0 with radom binary values , but whenver i call this function i get an error
??? 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));
please any help would be very much appreciated.
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