LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programatically build a cluster to identify the data type to read from a binary file

I am using Labview for data logging purposes building my own data logger for binary files.  I want to embed an identifier of some sort in the header of the file such that I can take the identifier and build a cluster to pass in as the data type for reading a sample of data from the rest of the file.  This includes nested clusters in the cluster.  If anyone has any experience the help would be appreciated.  Thanks

0 Kudos
Message 1 of 3
(3,819 Views)

You cannot programmatically build a cluster at run-time like that. That would require being able to change the code at run-time, and you cannot do this since an application cannot modify itself. Scripting will allow you to programmatically build a cluster, but it's not designed to be used in the way you're envisioning.

 

It sounds like perhaps a polymorphic VI would be better suited to what you are trying to do. You would write a VI to handle each of your possible formats and then you can use a case structure to pick out which VI to run to read your file based on the identifier in the header file.

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

Hello,

 

Have you considered an XML implementation? You could flatten LabVIEW Object data as XML strings, which in turn will be read into LabVIEW by providing a reference data type. There are built in XML schema VIs in LabVIEW. There are also a number of 3rd party libraries, like GXML, if you prefer a different type of organization and parsing algorithm. 

 

Cheers, 

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

Message 3 of 3
(3,761 Views)