フィルターのクリア

how to define 4 bit Enumerated value and a nibble(4 bits) in Matlab

6 ビュー (過去 30 日間)
PTP
PTP 2016 年 1 月 20 日
コメント済み: Walter Roberson 2016 年 2 月 1 日
Hello,
how to define 4 bit Enumerated value and a nibble(4 bits) in Matlab

採用された回答

Thorsten
Thorsten 2016 年 1 月 20 日
Use a number between 0 and 15.
n = 8;
To convert to binary
nbin = dec2bin(n) - '0';
dec2bin return a string, the -'0' converts this string to an array of 0's and 1's.
  5 件のコメント
PTP
PTP 2016 年 2 月 1 日
Now i tried and added after this code
nbin = dec2bin(s) - '0' This gave me an array of 0s and 1s.
How to align this array into single line so that I can see it. Also how to separate and extract the first 48 bits for eg from the array.
Then how to send these bytes contained in nbin to another laptop via UDP and on another Laptop how to regenerate those Bytes into a String so that Humans can read it.
Walter Roberson
Walter Roberson 2016 年 2 月 1 日
sBytes = uint8(s);
send sBytes. Reconstruct on the other side with
s = char(sBytes);
Do not bother converting to bits!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by