I have an array of decimal numbers with numbers like for example 2108784171. these numbers consist of 2 binary numbers from which the first 1:16 bits belong to a decimal number and the 17:32 bits belong to another decimal number. How can I split the decimal number array without first going to binary with dec2bin and then splitting it manually with:
firstDecimalNumber = bin2dec(binNumber(:,17:end));
secondDecimalNumber = bin2dec(binNumber(:,1:16));
I want the two decimal numbers but converting it twice, from decimal to binary and from binary to decimal takes too much time as this calculation is performed in a time sensitive loop. Is there a way to have a faster splitting method?
Best Answer