train puzzle solution vector

1 Ansicht (letzte 30 Tage)
yousef Yousef
yousef Yousef am 8 Apr. 2014
Lets say, the first column represents the trip number in a train station. The other columns represent the number of passengers coming from different gates (g1 g2 g3...g10).
So if the trip number is not repeated (which means there is only one trip a day), then put all passengers in one train. If the number is repeated (two shifts or more, in the morning, other in the evening & last at night).Take the passengers from 3 gates which have the largest number of passengers in the morning, other 3 in the evening & last group at night.
Trip # g1 g2 g3 g4 g5 g6 g7 g8 g9 g10
2 82 10 16 15 66 76 71 83 44 49
4 91 28 98 43 4 75 4 70 39 45
4 13 55 96 92 85 40 28 32 77 65
1 92 96 49 80 94 66 5 96 80 71
1 64 97 81 96 68 18 10 4 19 76
The result should look like this:
2:
83 82 76 71 66 49 44 16 15 10
8 1 6 7 5 10 9 3 4 2
4, 2:
98 91 75 70 45
3 1 6 8 10
4, 3:
43 39 28 4 4
4 9 2 5 7
1, 4:
96 96 94 92 80
2 8 5 1 4
1, 5:
80 71 66 49 5
9 10 6 3 7
w=[2 4 4 1 1]

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by