a = {rand(6000,7); rand(3600,7); rand(600,7)};mx = {randi(50,600,1), randi(50,600,1); randi(50,360,1), randi(50,360,1); randi(50,60,1), randi(50,60,1)};mn = {randi(50,600,1), randi(50,600,1); randi(50,360,1), randi(50,360,1); randi(50,60,1), randi(50,60,1)};q = mx;for x = 1:size(q,1) for y = size(mn,2) b = reshape(a{x}(:,7),10,[]).'; b = bsxfun(@minus,b,mn{x,y}); b = bsxfun(@rdivide,b,mx{x,y}-mn{x,y}); q{x,y} = reshape(b.',[],1); endend
I want to change the following line b = reshape(a{x}(:,7),10,[]).' into b = transpose(reshape(a{x}(:,7),60,[]).') but I get an error even though both reshaping commands give me a 60 x 10 double.
Error using bsxfun Non-singleton dimensions of the two input arrays must match each other.
Where is my mistake?
Best Answer