필터 지우기
필터 지우기

converting a 1x4096 cell, containing binary to 1x(4*4096) double containing binary codes

조회 수: 1 (최근 30일)
Hi,
My code generates a x by y matrix, containing random numbers within range of (0 to Order-1) as follow:
x=600; y=8; order=16; bits=randint(x, y ,order,1);
I convert the each integer value to binary as follow
binary=dec2bin(bits,log2(order));
which result in a matrix of class char. I then convert it into a cell array as follow
binary=cellstr(binary); binary=binary';
which results in a long cell row of lenght 4096 where each cell has log2(order) bits. how can I convert this row. such that I will have each single bit in a seperate cell of double class. such that I will end up with a 1x(4*4096) double
Many thanks

채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 23일
binary = (dec2bin(bits,log2(order)) - '0') .' ;
With no cellstr()

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by