How do I make a World Cup simulator with MATLAB?

5 views (last 30 days)
Er Le
Er Le on 20 May 2022
Commented: Er Le on 24 May 2022
I am currently making a World Cup simulator with matlab
The list below is the groups
How should I write the code to make my simulator work?
  • from each group, I want to choose 2 random teams
  • the 2 randomly chosen team would qualify to the tounament, which starts from the round of 16
Can someone help me?
B={'England';'IR Iran';'USA';'Euro Play-off'};
C={'Argentina';'Saudi Arabia';'Mexico';'Poland'};
D={'France';'IC Play-off 1';'Denmark';'Tuinisa'};
E={'Spain';'IC Play-off 2';'Germany';'Japan'};
H={'Portugal';'Ghana';'Uruguay';'Korea Republic'};

Accepted Answer

the cyclist
the cyclist on 20 May 2022
You can use the randperm function to select 2 out of 4 teams to advance in each section.
rng default
teamRank = randperm(4);
A_advance = A(teamRank(1:2))
A_advance = 2×1 cell array
{'Senegal'} {'Qatar' }

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by