How I can convert a binary number into Matrix

4 views (last 30 days)
I have 100110101010
I want 10
01
10
10
10
10
  1 Comment
Stephen23
Stephen23 on 20 Dec 2021
C = '100110101010'
C = '100110101010'
M = reshape(C,2,[]).'
M = 6×2 char array
'10' '01' '10' '10' '10' '10'

Sign in to comment.

Accepted Answer

yanqi liu
yanqi liu on 21 Dec 2021
yes,sir,if the data is logical type,may be use the follow process,or use Stephen method to reshape
a = logical([1 0 0 1 1 0 1 0 1 0 1 0])
a = 1×12 logical array
1 0 0 1 1 0 1 0 1 0 1 0
b = [a(1:2:end)' a(2:2:end)']
b = 6×2 logical array
1 0 0 1 1 0 1 0 1 0 1 0

More Answers (0)

Community Treasure Hunt

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

Start Hunting!