i have 128 values in a single variable..how can separate each 8 bits?? and then i convert the each 8 bit into ascii and then convert into string??
조회 수: 2 (최근 30일)
이전 댓글 표시
f=dec2bin(d);%i have 128 values in f
how can i separate each 8bits..and then convert into ascii and then string
댓글 수: 0
답변 (1개)
Star Strider
2014년 12월 29일
Since ‘f’ is already a (1x128) character array, you can create a matrix of its bytes using the rehape function:
bytes = reshape(f, 8, [])';
Each row is a consecutive byte. Again, it is already a character array, so converstion to a string is not necessary.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!