Hello,
I am having difficulties in converting a matrix of decimal numbers to its corresponding binary matrix. Here is the problem.
For example, we have a Matrix A;
A=[9 7 15 ; 4 14 8 ]
The range of values in matrix A is from 0 to 63 inclusive (64 possibility). A is in fact an 64 by 3 (64 rows by 3 columns).
First column is representing the sequential number of each row organizedly this means first row is 0 , second row is 1 , third rows is 2 ...etc till 64 row and its number is 63.
Second column each decimal number of its values ranges from 0 to 63 .
Third column each decimal number of its values ranges from 0 to 63 .
Accoding to what said above , the A matrix is an integer matrix(64x3) that it's like this : (once again first columns values are the sequential number of each row till number 63):
0 2 3
1 3 4
2 5 6
.....
.....
etc
.....
63 5 6
so what I need is to convert this matrix to binary matrix for each value this means that lets assume that I have one row of that matrix like [0 2 3]
so corresponded binary row matrix is (6bits for each value because in my case I have 64 possibility): [000000 000010 000011] .
that's just one row of matrix A, but I need to do this for all the matrix values to convert them to binary values as what I did above.
to clear more, another examples (lets assume I have matrix 2x3 - in my case once again I have matrix 64x3) which it's :
b=[0 0 1 ; 0 2 3] and as I said each binary value is consist of 6 bits because there's 64 possibilities. so that is 6 bits per decimal number.
so the corresponded matrix in binary to it for each corresponded value of matrix b is : [000000 000000 000001 ; 000000 000010 000011] .
Any help please how I can do that in matlab? I tried to use de2bi but didnt give me correct output as what I mentioned above.
Can you please help me out?
Hope to hear from you very soon.
Thank you in advance.
Regards.
댓글 수: 2
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/644958-decimal-matrix-to-binary-matrix-correspond-to-each-value-of-decimal-matrix#comment_1126963
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/644958-decimal-matrix-to-binary-matrix-correspond-to-each-value-of-decimal-matrix#comment_1126963
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/644958-decimal-matrix-to-binary-matrix-correspond-to-each-value-of-decimal-matrix#comment_1126973
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/644958-decimal-matrix-to-binary-matrix-correspond-to-each-value-of-decimal-matrix#comment_1126973
댓글을 달려면 로그인하십시오.