Exam Problem schedule matrix

3 visualizaciones (últimos 30 días)
yousef Yousef
yousef Yousef el 7 de Abr. de 2014
Comentada: yousef Yousef el 7 de Abr. de 2014
Let’s 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.
end
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, 1:
98 91 75 70 45
3 1 6 8 10
4, 2:
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
  2 comentarios
yousef Yousef
yousef Yousef el 7 de Abr. de 2014
I want to know what is wrong with this solution
finalresult=[];
for i=1:4
if true
% code
end
for j=i+1:5
result1=[];
result2=[];
result3=[];
if w(j)~=w(i)
[a,b]=sort(r(i,:),'descend');
presult1=b;
else
[c,d]=sort(r(j,:),'descend');
presult2=d(1:3);
presult3=d(4:6);
end
result1=[result1;presult1];
result2=[result2;presult2];
result3=[result3;presult3];
end
end
if true
% code
end
yousef Yousef
yousef Yousef el 7 de Abr. de 2014
w=[2 4 4 1 1

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by