Fixed bug.

time-shift
Stéphane Adjemian (Charybdis) 2010-02-18 23:50:13 +01:00
parent 1fbe76b95d
commit 9754bc7afa
1 changed files with 5 additions and 4 deletions

View File

@ -21,10 +21,11 @@ function C = bsxfun(fun,A,B)
dA = size(A); dA = size(A);
dB = size(B); dB = size(B);
if length(dB)~=length(dA) dim_correction = length(dA)-length(dB);
% Note that this function crashes if A and B are k-dimensional with k>2 and if the size of the last dimension is one. if dim_correction>0
% It is a bug, but we don't need this feature, so I do not investigate further... dB = [dB,ones(1,dim_correction)];
error(['A is a ' int2str(length(dA)) '-dimensional array whereas B is a ' int2str(length(dB)) '-dimensional array!']) elseif dim_correction<0
dA = [dA,ones(1,-dim_correction)];
end end
if all(dA==dB) if all(dA==dB)