How to permute binary numbers to a specific permutation

2 ビュー (過去 30 日間)
lilly lord
lilly lord 2020 年 10 月 17 日
コメント済み: lilly lord 2020 年 10 月 18 日
Hi I have numbers in binary form. I want to permute to 1 digit to right so that a new binary value is created.
0
F=[0 6 2 5 4 3 6 1]';
f=de2bin(F);%%the required binary form
e.g
Binary form 1 digit rt
0 000 000
6 011 101
2 010 001
5 101 110
4 001 101
3 110 011
1 100 010
7 111 111
How can I do it in matlab
Thanks in advance

採用された回答

Stephan
Stephan 2020 年 10 月 18 日
編集済み: Stephan 2020 年 10 月 18 日
F=[0 6 2 5 4 3 6 1]'
A = dec2bin(F)
B = circshift(A,1,2)
gives:
F =
0
6
2
5
4
3
6
1
A =
8×3 char array
'000'
'110'
'010'
'101'
'100'
'011'
'110'
'001'
B =
8×3 char array
'000'
'011'
'001'
'110'
'010'
'101'
'011'
'100'

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by