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 配列です。