A loop for scanning all binary sequences of length n with k 1's and n-k 0's
Show older comments
I want to write a loop that scans all binary sequences of length n with k 1's and n-k 0's.
Actually, in each iteration an action is performed on the sequence, then it goes to next sequence, if necessary. (I'm not looking for the functions like nchoosek or perms that return all such a sequences).
How to write such a loop? Thanks
4 Comments
Azzi Abdelmalek
on 24 Sep 2013
Is it a homework?
Mahdi
on 24 Sep 2013
Azzi Abdelmalek
on 24 Sep 2013
Then why are you asking to not use some functions?
Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!