%% Specify Minimum Number of Digits
% Specify the minimum number of binary digits that dec2bin returns. If you specify more digits are required, then dec2bin pads the output.

D = 23;
binStr = dec2bin(D,8)

%
% If you specify fewer digits, then dec2bin still returns as many binary digits as required to represent the input number.

binStr = dec2bin(D,1)

% Copyright 2019-2020 The MathWorks, Inc.