Shuffling values inside matrix based on few conditions

1 visualizzazione (ultimi 30 giorni)
Hello i have the following two matrices which are outputs of a procedure and the sizes of both the matrices will change depending on the situation but both the matrices will be of the same size 1. e size(TwoHopMat_1) = size(Final_matrix)
TwoHopMat_1 =
0 0 0 0 1
0 0 1 1 0
0 1 0 1 0
0 1 1 0 0
1 0 0 0 0
Final_matrix =
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 1 0 0 0
1 0 0 0 1
Now i need to shuffle the final_matrix such that i meet the following conditions after shuffling.
  • 1. Every column should have a minimum of one 1s
  • 2. If there exists a 1 in a particular position of TwoHopMat_1 then that particular position should not have 1 after shuffling.
  • 3. No Row or Column should have all zeros or all ones
The conditions should work even if we give matrices of size 100x100. Any help is appreciated

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by