05-17-2011 05:28 PM
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:
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:
======>
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!
05-17-2011 06:12 PM
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.
05-18-2011 06:45 AM
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.
05-18-2011 02:34 PM
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.