Please help with for loop!!!
이전 댓글 표시
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 3x10 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;
A
team_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
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Biomechanics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!