LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Binary File - variable binary format

Hi Everyone,

 

I'm using the "read from binary file" subvi to interpret some data from a file. I have the code running fine if the the temp file is always the same format, however I want the "read from binary file" to adapt to different file structures based on a user input. Here's a snapshot of my current VI:

Static Format.jpg

 

The structure of the file I'm reading can change, so I tried to make it so that user input would change the way labview interprets the binary structure. I did this using case structures. The issue I ran into is that the ouput of the different case structures merges into 1 line, and since each case structure's binary format is a different array size I get an error:

Variable Format2.jpg======>Variable Format1.jpg

 

 

Does anyone know of a way to remedy this issue?

 

If you take a look at my file, I was thinking about putting all of my commands that interpret the binary file and parse the data into a case structure similiar to the one above. I was trying to avoid this as I would end up with a set of the entire code in 12 different cases, and if I wanted to make a small change to the the code I would have to change all 12 cases.

 

Thanks for any suggestions!

0 Kudos
Message 1 of 4
(2,889 Views)

You cannot have two types of clusters on the same wire, e.g. after reading the unbundling will differ depending on the cluster. This is not allowed.

 

Maybe you should look into object oriented programming for a possible solution.

0 Kudos
Message 2 of 4
(2,881 Views)

One solution is to include the File Read into the case structure. But you need to find a way to return the different types of data records as you obviously can't connect them to the same indicator.

 

All in all I find your design rather crude anyhow. Reading a file and letting the user decide what data type to expect is going to give lots of errors. Instead the file should contain information of what is in there and the reading routine should decide based on that how to interpret the next bunch of data.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 3 of 4
(2,867 Views)

Altenback, thanks for the tip. I'll have to look into that method when I get a chance.

 

Roflk:

Unfourtunately the file is generated by another program. I've actually spoken to the programmer who wrote it about doing exactly what you suggested, including an information header, but until he is able to include this I was trying to find another method.

 

I found a slight workaround for the time being that should suffice.

0 Kudos
Message 4 of 4
(2,852 Views)