Info
この質問は閉じられています。 編集または回答するには再度開いてください。
hi,I wanted to know, how can i generate a 3 bit sequential binary vector with up to only ONE 1?
1 回表示 (過去 30 日間)
古いコメントを表示
Eg: 001, 010,100
0 件のコメント
回答 (1 件)
John D'Errico
2017 年 8 月 17 日
編集済み: John D'Errico
2017 年 8 月 17 日
Up to only ONE 1 means the number is any number (in decimal) from the set [0,1,2,4].
Pick an element at random from that set. Then convert to binary.
help dec2bin
1 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!