Help with table manipulation
1 view (last 30 days)
Show older comments
I have a table named "inputtable":
No. X1 X2 X3 X4 X5 X6 X7 X8 1 87 13 13 107 7 16 74 43 2 51 75 86 114 107 107 86 3 3 41 16 91 87 86 87 96 86 4 25 18 107 25 40 86 54 87 5 39 60 38 104 91 13 111 41 6 19 65 77 43 80 88 39 29 7 58 39 7 8 74 57 44 13 8 60 51 45 97 53 72 95 17 9 12 114 54 65 90 29 16 103 10 30 50 3 106 54 84 114 65
let's say X1 to X8 is the name of a team, while the numbers are members of the team (notice that some members are registered in multiple teams at once). I want to create a simulation of a round-robin tournament (each team gets to fight each other team) There's also some things that needs to be considered:
- There's 2 teams fighting in a match
- A team cannot fight itself (obviously xD)
- One team consists of 5 players playing
- A team member cannot play on more than one team at once in a single match (but he's allowed to change team in between matches)
- If a team member did, change team, it can only change team to the team it's registered to on the table above (Example the team member '13' can only change between team X2, X3, X6, X8)
- On one tournament two teams that already had fought cannot fight again (Example X1 vs X2 already happened so X2 vs X1 can't be conducted)
How can I generate a random round-robin match table, different results each time I generate the table? The example output would be like this:
No. TeamA TeamB A1 A2 A3 A4 A5 B1 B2 B3 B4 B5 1 1 2 87 51 30 58 30 18 60 65 114 39 2 1 3 41 51 19 30 12 3 86 91 77 13 3 1 4 60 12 51 41 25 107 114 87 25 104 4 1 5 30 39 25 12 41 57 88 107 84 16 5 1 6 30 12 60 58 19 13 114 51 50 39 6 1 7 87 51 41 25 39 29 111 54 74 16 7 1 8 12 30 51 25 19 13 87 86 43 3 8 2 3 13 75 16 18 77 7 45 3 91 13 9 2 4 114 51 41 58 60 114 106 8 97 43 ... 36 7 8 74 16 114 44 95 65 103 17 13 29
Is this possible to do in Matlab? Thank you so much for your attention
0 Comments
Answers (0)
See Also
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!