matlab中如何将十进制变成八位二进制

2024-12-03 14:54:59
推荐回答(1个)
回答(1):

你可以使用dec2base函数
dec2base(你的数,进制,位数)
DEC2BASE(D,B) returns the representation of D as a string in
base B. D must be a non-negative integer array smaller than 2^52
and B must be an integer between 2 and 36.
DEC2BASE(D,B,N) produces a representation with at least N digits.

例如
dec2base(12,2,8)

ans =

00001100