# How to convert unsigned integer 16 bit to decimal number

306 views (last 30 days)
Jim on 25 May 2013
Edited: Jan on 20 Feb 2018
Hi,
what is the difference between unsigned integer 16 bit
How can I convert uint16 to decimal number in matlab?
Thanks Jim

the cyclist on 25 May 2013
Edited: the cyclist on 25 May 2013
A uint16 is a 16-bit unsigned integer. You can read lots and lots of details about data types in MATLAB on this page: http://www.mathworks.com/help/matlab/data-types_data-types.html.
The default data type for most MATLAB calculations is "double", a double-precision real number. To convert a uint16 to a double:
x = double(xu16)
Walter Roberson on 26 May 2013
Dang promotion rules. It works for logical and char

Jan on 26 May 2013
The meaning of the type UINT16 is explained in:
help uint16
doc uint16
While UINT16 variables can contain integer values between 0 and 2^16-1, they are displayed as decimal numbers as doubles, singles and the other integer types also. Binary or octal numbers would be non-decimal.

mohd akmal masud on 20 Feb 2018
hi all,
i have image dicom 16 bit. Like below my image:
>> whos P
Name Size Bytes Class Attributes
P 256x256 131072 int16
My problem is, 16 bit image can stored pixel value till 32767 only. Now i want change it to 32 bit or 64 bit so that the pixel value can stored more than that, and corresponding how much activity radionuclides i used to diagnosed patient.
can you help to convert that using matlab? or anyway to solve it?
Jan on 20 Feb 2018
@mohd akmal masud: Please do not hijack an old existing thread by appending a new question in the section for answers. Afterwards it would be unclear, to which question an answer belongs and you cannot select an accepted answer. Delete this message here and open a new thread. Thanks.
By the way: P64 = int64(P)