is it possible to divide a decimal number into 3 decimal numbers?

1 view (last 30 days)
Hello everybody,
I want to break a 12-bit decimal number into 3 decimals numbers. FOR EXAMPLE. 1000 decimal = 0b 0011 1110 1000 = 3, 13 and 8 in decimal numbers.

Accepted Answer

Stephen23
Stephen23 on 17 Mar 2019
Edited: Stephen23 on 17 Mar 2019
>> N = 1000;
>> R = 3;
>> C = R+R*fix(log2(N)/R);
>> M = reshape(dec2bin(N,C),[],R).'
M =
0011
1110
1000
>> bin2dec(M)
ans =
3
14
8

More Answers (0)

Categories

Find more on Interactive Model Editing in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!