Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How to convert unsigned integer 16 bit to decimal number

Asked by Jim on 25 May 2013


what is the difference between unsigned integer 16 bit

How can I convert uint16 to decimal number in matlab?

Thanks Jim




No products are associated with this question.

2 Answers

Answer by the cyclist on 25 May 2013
Edited by 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:

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)


Jim on 26 May 2013


Thanks for your reply. what is the need of adding zero to uint16. what exactly going on in this operation

Thanks jim

the cyclist on 26 May 2013

@Jim, I think Walter had in mind that doing this operation would add zero to the 16-bit unsigned integer variable xu16, but would also convert x a double. [But that did not work for me when I ran it.]

Walter Roberson on 26 May 2013

Dang promotion rules. It works for logical and char

the cyclist
Answer by Jan Simon 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.


Jan Simon

Contact us