LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a binary file using the type cast function is not working

Hello

 

I am trying to read a binary file.  Using the Read from binary file and type cast functions I can actually get the information from the file.

I set an indicator in the “Normal” option in Properties. I can read the header and footer but not the body of the file; For the body of the file all I can see is characters of the type

“C¾ Ü Qþ  X@ “. One of the other options, Password, seems to provide an output of just the characters that were originally written, but then again, I can not read the characters because it is only asterisks and I can not copy them onto a word processor either.

I tried setting the indicator in Hexadecimal mode, then creating a local variable that acts as a control and use the type cast function again to see if  could convert the Hexadecimal string to readable ASCII characters; unfortunately, this did not work either.

 

I don’t know what else I should try or if there is something that I may not be doing right and for that reason I am not getting the desired results. I hope someone has an idea about this issue.

Regards,

Roberto

0 Kudos
Message 1 of 3
(2,162 Views)
You really need to know more about the format of the binary file before you can do anything with it.  Perhaps the first bytes of the file are information that tells about the size or format of the rest of the file.  An .xls file is a binary file with a complicated structure that tells Excel how to recreate your spreadsheet.  The rest of the file may be data such as color info in a .bmp file, or bytes representing numeric data.  What is this file supposed to be and where did you get it from?
 
You talk about an indicator.  It sounds like a string indicator.  A string indicator is a series of ascii characters.  Normal setting for the indicator shows normal ascii representation.  So a byte of decimal value 65 shows up as "A".  Hexadecimal shows that same byte as 41.  Password display just shows asterisks to hide the data stored in the control or indicator.
 
It comes down to where did you get the file and what is supposed to be stored in it.  How was it created?  Once you crack that code, then you can figure out how to read it.  If you know it was created by labview and it stores double precision numbers, wire a constant with a double precision representation into the file VI.
0 Kudos
Message 2 of 3
(2,160 Views)

Thank you for your reply,

Well, actually I don’t have any information about this file. I will try to obtain information about it though.

This is a file that contains velocity information; there are 65 channels that form a velocity profile in a pipe. Also, there are 4096 velocity profiles. I don’t know what is the format of these values.

 

The software that creates the file provides a text file. Using this text file the velocity information can be processed and then plotted.

 

I want to avoid all these intermediate steps and read, process and plot everything using only LabView. BTW, I am using LabView 8.2

 

Roberto

 

 

 

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