From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Read from Binary File" format in Hex?

Solved!
Go to solution

Is there any way I can set the data type of the function, 'Read From Binary File' so it is outputting in Hex format? 

0 Kudos
Message 1 of 9
(6,435 Views)

Do you know what it means to "Read from Binary File"?  It means (among other things) that there is no such thing as "format" -- you are reading binary, the sequence of bits that are in the file into a series of memory locations on the PC.  If the data are stored as strings, your memory will have (typically) 16-bit Ascii characters.  If it is double-precision Floats, it will have 64-bit numeric data largely uninterpretable unless you read it into a Float variable.  If it is a complex mixture of data representing various data types, you will need to know exactly the type of data that was written to the file so that you can read back in the same type of data

 

Once you have the data back in memory as one or more variables, you are free to represent the value of those variables in whatever format you choose.

 

Bob Schor

Message 2 of 9
(6,424 Views)

If you want to represent the contents of a Binary file as though it were Hex, simply read the file as an Array of U8 (single bytes), U16, U32, or U64 and output it in the appropriate Hex representation as 2, 4, 8, 16, or 32 Hex characters each.

 

[If that was what you were asking, I apologize for not understanding the question].

 

Bob Schor

0 Kudos
Message 3 of 9
(6,423 Views)

Read it as a plain string and set the string indicator to hex display.

0 Kudos
Message 4 of 9
(6,418 Views)

@AndreaD wrote:

Is there any way I can set the data type of the function, 'Read From Binary File' so it is outputting in Hex format? 


Same question I have with a lot of people who are dealing with serial communications: What exactly do you mean by "Hex format".  Is the data in the file raw binary data that you just want to be able to view as hexidecimal?  Or is the data in a human readable (ASCII) format that just has hex digits (0-9,A-F) (I call this ASCII Hex)?


GCentral
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 5 of 9
(6,350 Views)

Maybe I should clarify ... in the "Read from Binary File", I'd like the info from "data" (or an equivalent output) to be in Hex format. I tried setting the data type to hex, but I don't think it's done correctly 

 

Thanks, 

Andrea 

0 Kudos
Message 6 of 9
(6,340 Views)

Change the display mode of your array indicator called "data" to hex.

0 Kudos
Message 7 of 9
(6,333 Views)

Where would I go to change this? ... I tried right clicking, but couldn't find the option 

0 Kudos
Message 8 of 9
(6,316 Views)
Solution
Accepted by topic author AndreaD

Front panel.  Right Click.   Display Format.

Message 9 of 9
(6,314 Views)