I am trying to create a draft sort of thing. Where there are two teams team A and team B. They take turns choosing from 10 players(rand 3×10 matrix with first column as jersey number, second column as free throw %, and third row as rebounds/game). Team A wants best free throws. Team B wants best best rebounds. I have the loop to select these but I can't figure out how to delete the player after the team has selected him. Please help!!! Code:
A= zeros(3,10);Z=[1:1:10];A(1,:,:)=Z;B=.5+rand(1,10)*.4;A(2,:,:)=B;C=round(1+rand(1,10)*7);A(3,:,:)= C;Ateam_A= zeros(3,5);team_B= zeros(3,5);for d=[1:1:10] j=10; k=9; if rem(d,2)==1; for e=[1:1:j] A(2,e,:)= max(B); p=e; team_A(:,2,:)=A(:,p,:); A(:,p)=[]; end elseif rem(d,2)==0 for f=[1:1:k] A(3,f,:)= max(C); i=f; team_B(:,3,:)=A(:,i,:); A(:,i)=[]; end end j=j-2; k=k-2;end
Best Answer