How to code a binary for some possition to change status for bus

2 次查看(过去 30 天)
Dear all, I have this table:
BusNo Bus ID
1 1
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
and then I want to change state Bus ID of some buses 2, 4,7,8 for example from 0 to 1. and I want to show all cases can change. For example: fistly, I only change 1 bus, so we have 4 case like this:
BusNo Bus ID Case 11 Case 12 Case 13 Case 14
1 1 1 1 1 1
2 0 1 0 0 0
3 0 0 0 0 0
4 0 0 1 0 0
5 0 0 0 0 0
6 0 0 0 0 0
7 0 0 0 1 0
8 0 0 0 0 1
9 0 0 0 0 0
10 0 0 0 0 0
next I want to change 2 bus
BusNo Bus ID Case 15 Case 16 Case 17 Case 18 Case 19 Case 20
1 1 1 1 1 1 1 1
2 0 1 1 1 0 0 0
3 0 0 0 0 0 0 0
4 0 1 0 0 1 1 0
5 0 0 0 0 0 0 0
6 0 0 0 0 0 0 0
7 0 0 1 0 1 0 1
8 0 0 0 1 0 1 1
9 0 0 0 0 0 0 0
10 0 0 0 0 0 0 0
and so on for all case. Could you help me to code this command. Thanks.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Modeling 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by