temp(i,1) = rand(1)*(pb(1,num).pos(i,1) - pw(1,num).pos(i,1));
この行により、次のエラーが発生します。
Error using ==> minus
Not enough input arguments.
pb
との定義は次のとおりですpw
。
pw=struct('fitness',[],'pos',{});
pb=struct('fitness',[],'pos',{});
pos
は 2 x 1 配列です。