how to permute all combinations of this vector??
Mostra commenti meno recenti
hello i'm struggling to write code for this problem; I want to display all possible combinations of the vectors of the form (1,b1,b2,b3,.....bN),where bi∈{0,1}
so the first entry of the vector is always 1 and the rest take the value 0 or 1. I then want to print every combination of this. How would you go about coding this ?? thanks for your help in advance
2 Commenti
John D'Errico
il 3 Mar 2018
Modificato: John D'Errico
il 3 Mar 2018
How large is N?
You should recognize that for large N, the solution might require billions of permutations.
Essentially, you can think of the result as the binary representations of all integers of the form
2^(N+1) + K
where K is any integer < 2^N with exactly sum(B) non-zero bits. I'm not sure that really helps a lot.
michaelsmith
il 3 Mar 2018
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!