ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to show number in hexdecimal format of given length

Solved!
Go to solution

Hi all,

  I want to show a 32bit number in hexdecimal format. In the number control, right click menu and I click into the "Display Format", I can change the format to hex. But I wonder if there is any way to show the hex number with given number of places holder. In C language, I can plot the number as

 

printf( "%.10x", number)

 

so to keep the result for total 10 places. I find an "advanced editing mode" in "Display Format" but I didn't get the "%.10x" work. Any idea? 

0 Kudos
Message 1 of 3
(3,267 Views)
Solution
Accepted by topic author PKIM

Hexdecimal number are integers, so there should be no period in the format. You don't need the advanced format.

 

SImply set the format to hexadecimal, set a minimum field width, and pad with zeroes on the left.

0 Kudos
Message 2 of 3
(3,239 Views)

A 32-bit number can only be represented by 8 hexidecimal digits.  So I would use %08x for the format.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 3
(3,175 Views)