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!